diff --git a/src/DurableTask.Core/TaskOrchestrationDispatcher.cs b/src/DurableTask.Core/TaskOrchestrationDispatcher.cs index 764d885e9..42564cddf 100644 --- a/src/DurableTask.Core/TaskOrchestrationDispatcher.cs +++ b/src/DurableTask.Core/TaskOrchestrationDispatcher.cs @@ -406,7 +406,7 @@ protected async Task OnProcessWorkItemAsync(TaskOrchestrationWorkItem work else // Abandon work item in all other cases (will be retried later). { await this.orchestrationService.AbandonTaskOrchestrationWorkItemAsync(workItem); - break; + return true; } } } @@ -1059,9 +1059,10 @@ TaskMessage ProcessScheduleTaskDecision( eventId: scheduleTaskOrchestratorAction.Id, name: scheduleTaskOrchestratorAction.Name, version: scheduleTaskOrchestratorAction.Version, - input: scheduleTaskOrchestratorAction.Input) { - Tags = scheduleTaskOrchestratorAction.Tags - }; + input: scheduleTaskOrchestratorAction.Input) + { + Tags = scheduleTaskOrchestratorAction.Tags + }; ActivitySpanId clientSpanId = ActivitySpanId.CreateRandom(); @@ -1080,9 +1081,10 @@ TaskMessage ProcessScheduleTaskDecision( scheduledEvent = new TaskScheduledEvent( eventId: scheduleTaskOrchestratorAction.Id, name: scheduleTaskOrchestratorAction.Name, - version: scheduleTaskOrchestratorAction.Version) { - Tags = scheduleTaskOrchestratorAction.Tags - }; + version: scheduleTaskOrchestratorAction.Version) + { + Tags = scheduleTaskOrchestratorAction.Tags + }; if (parentTraceActivity != null) { diff --git a/test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs b/test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs index aa3ca3355..aee05e945 100644 --- a/test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs +++ b/test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs @@ -2518,6 +2518,9 @@ public async Task OrchestrationRejectsWithVersionMismatch() status = await client.GetStatusAsync(); Assert.IsTrue(OrchestrationStatus.Running == status?.OrchestrationStatus || OrchestrationStatus.Pending == status?.OrchestrationStatus); + var history = await client.GetOrchestrationHistoryAsync(client.InstanceId); + Assert.AreEqual(0, history.Count, "A rejected orchestration should have no history as it should never have been started."); + await host.StopAsync(); } }