-
Notifications
You must be signed in to change notification settings - Fork 11
TaskEx: parallelLimit #143
Copy link
Copy link
Open
Labels
feature requestNew feature or enhancement requestNew feature or enhancement requesttopic: task-exRelated to the proposed new TaskEx library, which should get its own oss havenRelated to the proposed new TaskEx library, which should get its own oss haven
Milestone
Metadata
Metadata
Assignees
Labels
feature requestNew feature or enhancement requestNew feature or enhancement requesttopic: task-exRelated to the proposed new TaskEx library, which should get its own oss havenRelated to the proposed new TaskEx library, which should get its own oss haven
Replaces #129. TaskEx top level issue: #139
Async.Parallel's optional degree of parallelism parameter was added late in the game, but is critical - dumping an arbitrary unbounded number of work items onto the threadpool is not something that should be easy and/or the default thing to do without due consideration for how that will work under stess.There are some other shortcomings, which frequently lead to various bespoke helpers proliferating:
fun computations -> Async.Parallel(computations, maxDegreeOfParallelism=dop)etc) (note this is not the case forAsync.Sequential)Async.Paralleland direct consumption within an app might be useful)Current proposed APIs (will be updated inline based on any discussion below):
NOTES:
Async<unit>tasks. Having to use|> Async.Ignore<unit[]>is ugly for that (and most people probably do|> Async.Ignore, which prevents the compiler from helping you if your computations start to return values where they previously returnedunit)Task, considering cancellation tokens (see TaskEx: Async.startImmediateAsTask #142) and unwrappingAggregateExceptions (see TaskEx: AwaitTaskCorrect / Task.toAsync / Async.ofTask #141). Providing an equivalent of this that works well withtaskexpressions should likely be prototyped alongside any permanent API for this. Example impl. Also, perhaps aTask.sequentialmight make senseThrottledin the name is pretty well established in multiple internal library suites, and in posts such as https://www.compositional-it.com/news-blog/improved-asynchronous-support-in-f-4-7