GitShow/sindresorhus/p-throttle
sindresorhus

p-throttle

Throttle promise-returning & async functions

by sindresorhus
Star on GitHubForknpm

JavaScript

518 stars32 forks16 contributorsQuiet · 8mo agoSince 2016v8.1.0MIT

Meet the team

See all 16 on GitHub →
sindresorhus
sindresorhus42 contributions
Richienb
Richienb4 contributions
dormeiri
dormeiri3 contributions
BendingBender
BendingBender2 contributions
SamVerschueren
SamVerschueren2 contributions
schinkowitch
schinkowitch1 contribution
darcyparker
darcyparker1 contribution
edy
edy1 contribution

Languages

View on GitHub →
JavaScript97.9%
TypeScript2.1%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
mikestaub
Support `leading` and `trailing` optionsClosedIssue

I need this feature, I would be happy to submit a PR if you give me a quick tip on how you think it should be implemented. Same as the lodash options. https://lodash.com/docs/4.17.11#throttle

mikestaub · 8mo ago
adrukh
New ways to prevent starvation of throttled callsClosedIssue

Continuing #2, I am concerned with the simple scenario where the rate at which executions are being made exceeds the rate at which they are resolved due to the throttling config. This time, the concern is not around memory exhaustion, but around the ever-growing delay in executing the next call being made. Using the function is a way to deal with this situation, with two drawbacks as I see them: it is hard to employ this 'flushing' with precision. For example, periodically checking the throttler to see how many pending executions are there, 'flushing' only several of them, choosing whether to 'flush' by FIFO or LIFO, etc. when pending executions are aborted, they reject with an . I'd love to have an option to have aborted executions resolve with a value that depends on the execution arguments. As a solution, I'm basically thinking of adding a way to peek into the throttledFn object, and extending the function with the following argument: Would appreciate feedback on relevance, direction, and anything else.

adrukh · 8mo ago
Richienb
Add `pThrottleConcurrency` and make `pThrottle` a named export `pThrottleRate`MergedPR

concept art Fixes https://github.com/sindresorhus/promise-fun/issues/23

Richienb · 8mo ago
Structured data for AI agents

Repository: sindresorhus/p-throttle. Description: Throttle promise-returning & async functions Stars: 518, Forks: 32. Primary language: JavaScript. Languages: JavaScript (97.9%), TypeScript (2.1%). License: MIT. Latest release: v8.1.0 (8mo ago). Open PRs: 0, open issues: 0. Last activity: 8mo ago. Community health: 85%. Top contributors: sindresorhus, Richienb, dormeiri, BendingBender, SamVerschueren, schinkowitch, darcyparker, edy, TehShrike, mvila and others.

·@ofershap

Replace github.com with gitshow.dev