Skip to content

Commit

Permalink
fix: prevent exceeding the maximum stack call size when emptying larg…
Browse files Browse the repository at this point in the history
…e queues (#1660)
  • Loading branch information
lake-toya committed Mar 21, 2020
1 parent dbe2549 commit 4b6031d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/queue.js
Expand Up @@ -750,7 +750,9 @@ Queue.prototype.empty = function() {
if (jobKeys.length) {
multi = this.multi();

multi.del.apply(multi, jobKeys);
for (let i = 0; i < jobKeys.length; i += 10000) {
multi.del.apply(multi, jobKeys.slice(i, i + 10000));
}
return multi.exec();
}
});
Expand Down

0 comments on commit 4b6031d

Please sign in to comment.