-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redlock service #182
Redlock service #182
Conversation
} | ||
|
||
private async lockOnce(key: string, keyExpiration: number): Promise<boolean> { | ||
const result = await this.redis.setnx(key, '1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SETNX
is deprecated. You can use SET
with the NX
option
private async lockOnce(key: string, keyExpiration: number): Promise<boolean> { | ||
const result = await this.redis.setnx(key, '1'); | ||
if (result === 1) { | ||
await this.redis.pexpire(key, keyExpiration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use SET
, you can provide an expiration time and there is no need to make another call to redis
* redlock basic functionality * renamed metric correctly * set acquired duration also when not timing out * added redlock folder in index * extend ttl concept, improved logging * log level, other refactorings * use single set function with expiry integrated
* redlock basic functionality * renamed metric correctly * set acquired duration also when not timing out * added redlock folder in index * extend ttl concept, improved logging * log level, other refactorings * use single set function with expiry integrated
No description provided.