Skip to content

Commit

Permalink
chore: do not emit expire if removing key from set fails
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Sep 3, 2021
1 parent 0b72eae commit c1aab63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/locky.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,11 @@ class Locky extends EventEmitter {

const trx = redisClient.multi();
trx.srem(this.currentLocksKey, keysToExpire);
await promisify(trx.exec.bind(trx))();
const results = await promisify(trx.exec.bind(trx))();

// Results are null if a watch key has been modified
// during the transaction execution
if (results === null) return;

await Promise.all(
keysToExpire.map((key) =>
Expand Down

0 comments on commit c1aab63

Please sign in to comment.