Comments (4)
I think this is already implemented in promiseUtils.mapLimit
- what would you want from that function that isn't already built in?
from promise-utils.
Also, fwiw - I'm not sure that as written your code actually implements the throttling correctly. Since you've already created the promises, they are going to get executed whether you are awaiting them or not. You need to only invoke the function that generates the promise when there is sufficient remaining concurrency to deal with it.
from promise-utils.
Sorry, you're absolutely right not sure how I missed it when looking through the docs. promiseUtils.mapLimit
is what I'm looking for!
The promiseThrottle
function will work because of promiseFuncs.shift()()
which will invoke the function that returns the promise which will then start executing.
from promise-utils.
ah ya i didn't notice that the original map returned a lambda, not just invoked one.
from promise-utils.
Related Issues (10)
- Readme - filtering when it should be mapping
- [Bug] flatMap() maps empty arrays into the returned value HOT 1
- Sourcemaps broken ... HOT 3
- Bug: 1.24.1 not in npm registry HOT 1
- Wrong implementation for settleAll function
- map does not work with iterables other than strings, arrays and plain objects HOT 4
- Preserve order of settleAll results if error occurs HOT 1
- `defer` function inspired by `useDeferredValue` hook in React
- Doesn't work with Typescript
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from promise-utils.