Skip to content

Commit

Permalink
fix(): prevent uniqueId overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartozzz committed Apr 5, 2020
1 parent 924fed6 commit e961a6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ export default class Queue extends EventEmitter {
throw new Error(`You must provide a function, not ${typeof tasks}.`);
}

this.tasks.set(this.uniqueId++, tasks);
this.uniqueId = (this.uniqueId + 1) % Number.MAX_SAFE_INTEGER;
this.tasks.set(this.uniqueId, tasks);

// Start the queue if the queue should resolve new tasks automatically and
// hasn't been forced to stop:
Expand Down

0 comments on commit e961a6e

Please sign in to comment.