I'm reading source code to figure out how this lib works and I think #isIntervalPaused maybe useless and brings lots of related useless code.
if (!this.#isPaused) {
const canInitializeInterval = !this.#isIntervalPaused; // THIS IS USELESS , REMOVE IT
if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {
const job = this.#queue.dequeue();
if (!job) {
return false;
}
this.emit('active');
job();
if (canInitializeInterval) { // CHANGE 'canInitializeInterval' TO ‘this.#intervalId === undefined’ and remove any code no longer used
this.#initializeIntervalIfNeeded();
}
return true;
}
}
As shown above, when code changes, all tests passed.
I found that these codes were introduced in this pr to enable p-queue the ability to throttle the queue, but #isIntervalPaused seems to be useless in this case, for that when I remove it from code as shown above, all test still passed, anyone can help me figure it out? Thanks.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too