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
I would like to observe every time I reach the throttling limit and get delayed.
I think I can achieve it by calling a callback function when getDelay() is greater than zero here:
getDelay()
p-throttle/index.js
Line 83 in 3dffe70
The callback function can be passed as one of the options in:
Line 8 in 3dffe70
I suggest something like this: onDelay: (info: { delay: number, queueSize: number }) => void | Promise<void>, WDYT?
onDelay: (info: { delay: number, queueSize: number }) => void | Promise<void>
I can open a PR if it helps.
Edit: I can live without passing the info to the callback, so this also works for my use-case: onDelay: () => void | Promise<void>
info
onDelay: () => void | Promise<void>
The text was updated successfully, but these errors were encountered:
What's the use-case?
Sorry, something went wrong.
I want to send a metric when delayed to analyze the performance of my app
I opened a suggestion PR just in case it is OK by you to add this functionality :) #47
onDelay
Successfully merging a pull request may close this issue.
I would like to observe every time I reach the throttling limit and get delayed.
I think I can achieve it by calling a callback function when
getDelay()
is greater than zero here:p-throttle/index.js
Line 83 in 3dffe70
The callback function can be passed as one of the options in:
p-throttle/index.js
Line 8 in 3dffe70
I suggest something like this:
onDelay: (info: { delay: number, queueSize: number }) => void | Promise<void>
, WDYT?I can open a PR if it helps.
Edit: I can live without passing the
info
to the callback, so this also works for my use-case:onDelay: () => void | Promise<void>
The text was updated successfully, but these errors were encountered: