File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ internal TaskActivityDispatcher(
6767 this . logHelper = logHelper ;
6868 this . errorPropagationMode = errorPropagationMode ;
6969 this . exceptionPropertiesProvider = exceptionPropertiesProvider ;
70+
71+ if ( maxDispatchCount <= 0 )
72+ {
73+ throw new ArgumentOutOfRangeException ( nameof ( maxDispatchCount ) , "The maximum dispatch count must be greater than 0" ) ;
74+ }
7075 this . maxDispatchCount = maxDispatchCount ;
7176
7277 this . dispatcher = new WorkItemDispatcher < TaskActivityWorkItem > (
@@ -193,7 +198,7 @@ async Task OnProcessWorkItemAsync(TaskActivityWorkItem workItem)
193198 if ( scheduledEvent . DispatchCount > this . maxDispatchCount || scheduledEvent . IsPoisoned )
194199 {
195200 string message = scheduledEvent . IsPoisoned
196- ? "Activity worker has recenved an event that does not specify an Activity name"
201+ ? "Activity worker has received an event that does not specify an Activity name"
197202 : $ "Activity worker has received an event with dispatch count { taskMessage . Event . DispatchCount } which exceeds " +
198203 $ "the maximum dispatch count of { this . maxDispatchCount } ";
199204
Original file line number Diff line number Diff line change @@ -76,6 +76,11 @@ internal TaskEntityDispatcher(
7676 this . exceptionPropertiesProvider = exceptionPropertiesProvider ;
7777 this . entityOrchestrationService = ( orchestrationService as IEntityOrchestrationService ) ! ;
7878 this . entityBackendProperties = entityOrchestrationService . EntityBackendProperties ;
79+
80+ if ( maxDispatchCount <= 0 )
81+ {
82+ throw new ArgumentOutOfRangeException ( nameof ( maxDispatchCount ) , "The maximum dispatch count must be greater than 0" ) ;
83+ }
7984 this . maxDispatchCount = maxDispatchCount ;
8085
8186 this . dispatcher = new WorkItemDispatcher < TaskOrchestrationWorkItem > (
Original file line number Diff line number Diff line change @@ -250,6 +250,11 @@ public TaskHubWorker(
250250 this . logHelper = new LogHelper ( loggerFactory ? . CreateLogger ( "DurableTask.Core" ) ) ;
251251 this . dispatchEntitiesSeparately = ( orchestrationService as IEntityOrchestrationService ) ? . EntityBackendProperties ? . UseSeparateQueueForEntityWorkItems ?? false ;
252252 this . versioningSettings = versioningSettings ;
253+
254+ if ( maxDispatchCount <= 0 )
255+ {
256+ throw new ArgumentOutOfRangeException ( nameof ( maxDispatchCount ) , "The maximum dispatch count must be greater than 0" ) ;
257+ }
253258 this . maxDispatchCount = maxDispatchCount ;
254259 }
255260
Original file line number Diff line number Diff line change @@ -86,8 +86,14 @@ internal TaskOrchestrationDispatcher(
8686 this . entityParameters = TaskOrchestrationEntityParameters . FromEntityBackendProperties ( this . entityBackendProperties ) ;
8787 this . versioningSettings = versioningSettings ;
8888 this . exceptionPropertiesProvider = exceptionPropertiesProvider ;
89+
90+ if ( maxDispatchCount <= 0 )
91+ {
92+ throw new ArgumentOutOfRangeException ( nameof ( maxDispatchCount ) , "The maximum dispatch count must be greater than 0" ) ;
93+ }
8994 this . maxDispatchCount = maxDispatchCount ;
9095
96+
9197 this . dispatcher = new WorkItemDispatcher < TaskOrchestrationWorkItem > (
9298 "TaskOrchestrationDispatcher" ,
9399 item => item == null ? string . Empty : item . InstanceId ,
You can’t perform that action at this time.
0 commit comments