blend / promise-utils

Lodash-like, dependency-free utilities for native ES6 promises.
MIT License
282 stars 15 forks source link

Use map inside of settleAll to limit concurrency #54

Closed millerick closed 3 years ago

millerick commented 3 years ago

Reduces likelihood of creating a thundering herd effect when using settleAll.

ftrimble commented 3 years ago

Including some offline conversation for posterity:

the problem is that it's an array of promises 5:08 so that won't actually help 5:08 i.e. they've already been kicked off 5:09 map only helps because it only actually begins the invocation once it gets to a certain value

Michael Millerick 5:10 PM D'oh, true 5:11 So theoretically promiseUtils.map() can be dropped into settleAll ?

Forest Trimble 5:11 PM it will not achieve the same result 5:12 settle all runs on a Promise[]; map returns a Promise<T[]> 5:12 the error handling of settleAll will be lost if you throw a map in there