We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setTimeout
When getDelay() returns 0 there is no need to call setTimeout, it creates redundant event-loop event.
getDelay()
0
https://github.com/sindresorhus/p-throttle/blob/3dffe707c0061370be8ce0a8c687bd032b6acaef/index.js#L83-85
My suggestion:
queue
execute
queue.delete(timeoutId);
timeoutId
WDYT?
I can open a PR if it helps.
The text was updated successfully, but these errors were encountered:
👍
I don't think it will help much in real-world situations though, as the bottleneck is IO not the this package or the event-loop.
Sorry, something went wrong.
I generally agree, however it is more for when there are many events in the event-loop, then the execution start will get delayed.
Here is a PR #46
onDelay
Successfully merging a pull request may close this issue.
When
getDelay()
returns0
there is no need to callsetTimeout
, it creates redundant event-loop event.https://github.com/sindresorhus/p-throttle/blob/3dffe707c0061370be8ce0a8c687bd032b6acaef/index.js#L83-85
My suggestion:
getDelay()
is greater than0
setTimeout
and insert it to thequeue
.execute
directly, callqueue.delete(timeoutId);
only iftimeoutId
is defined.WDYT?
I can open a PR if it helps.
The text was updated successfully, but these errors were encountered: