Closed cowboyd closed 2 years ago
Latest commit: b4acb1f7b903e76786654b58d4cc99a6bda80918
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Looks like a good idea
Should this not be part of effection itself?
At the moment, I don't see any max task restriction, is this still to be added?
Looks like a good idea
Should this not be part of effection itself?
At the moment, I don't see any max task restriction, is this still to be added?
Yes, this is more of a proving ground for the idea, and then when we're happy with it we can add it to Effection proper. I was thinking something like
function* run() {
let group = yield createTaskGroup('socket handlers', {
maxConcurrency: 200,
drop: 'latest'
});
}
Motivation
Instead of using an option 'blockParent'. We can explicitly spawn different tasks into collections of groups that can be waited upon individually. This not only makes which group a task is part of explicit, but it allows flexibility in how you consume the blocking tasks.
This is fairly common in other structured concurrency frameworks like Swift or ember-concurrency, and can be expanded upon to add other aspects like "how many concurrent things can be going at the same time" or "what do we do when the max concurrency is attained... do we drop incoming operations? do we respond with a "503 operation"? do we cancel the currently running things? do we enqueue the new operations? How many do we enqueue?"
So this is an experiment in what that might look like.