Skip to content

Commit

Permalink
prevent infinite collection of attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tithra committed Feb 5, 2025
1 parent 5138813 commit 0fd0efb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ export default class Redlock extends EventEmitter {
args
);

attempts.push(stats);
// Infinite retry may result in memory leak when routine() is on hold for long time
if (maxAttempts !== Infinity) attempts.push(stats);

// The operation achieved a quorum in favor.
if (vote === "for") {
Expand Down

0 comments on commit 0fd0efb

Please sign in to comment.