-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
WorkflowOptions support for configuring max number of concurrent tasks. #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hello, |
@@ -67,6 +70,16 @@ public void UseErrorRetryInterval(TimeSpan interval) | |||
{ | |||
ErrorRetryInterval = interval; | |||
} | |||
|
|||
public void UseMaxConcurrentItems(int? maxConcurrentItems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should make this explicitly the max number of concurrent workflows rather than items?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me make that change you've suggested. Most consumers of your API may not ever dig into the internals, and thus not know what maxConcurrentItems really means, but framing it as "max number of concurrent workflows" is more intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of modifying EventConsumer directly, I'll move the change to WorkflowConsumer...that way the other child consumers can keep their default behavior the way you intended.
@@ -13,7 +13,7 @@ internal class EventConsumer : QueueConsumer, IBackgroundTask | |||
private readonly IPersistenceProvider _persistenceStore; | |||
private readonly IDistributedLockProvider _lockProvider; | |||
private readonly IDateTimeProvider _datetimeProvider; | |||
protected override int MaxConcurrentItems => 2; | |||
protected override int MaxConcurrentItems => WorkflowOptions.MinimumNumberOfConcurrentItems; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense to me... is this a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was intentional, because MaxConcurrentItems as a function of the number 2 was showing in two places, the EventConsumer and QueueConsumer. And then I added a 3rd place it where it shows up in the WorkflowOptions class. I was concerned the number 2 was becoming a magic number duplicated in too many locations, and so an explicitly named constant helps to maintain the context of what the value 2 is for. This change doesn't add a ton of value, so I can revert it if its problematic.
…cific to WorkflowConsumer only.
No description provided.