Skip to content

Commit e587e35

Browse files
committed
Fix history events buildup from version reject
When an orchestration was being rejected due to a versioning mismatch an issue would cause the history events of the orchestration to build continuously. This was caused by the orchestration adding an OrchestrationStarted event before the versioning took place and was saved even on a rejected version. This change causes the versioning code to exit the process method entirely instead of just prematurely end the process loop. This avoids the commit of the history. Signed-off-by: halspang <halspang@microsoft.com>
1 parent 1c09332 commit e587e35

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/DurableTask.Core/TaskOrchestrationDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
406406
else // Abandon work item in all other cases (will be retried later).
407407
{
408408
await this.orchestrationService.AbandonTaskOrchestrationWorkItemAsync(workItem);
409-
break;
409+
return false;
410410
}
411411
}
412412
}

test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,9 @@ public async Task OrchestrationRejectsWithVersionMismatch()
25182518
status = await client.GetStatusAsync();
25192519
Assert.IsTrue(OrchestrationStatus.Running == status?.OrchestrationStatus || OrchestrationStatus.Pending == status?.OrchestrationStatus);
25202520

2521+
var history = await client.GetOrchestrationHistoryAsync(client.InstanceId);
2522+
Assert.AreEqual(0, history.Count, "A rejected orchestration should have no history as it should never have been started.");
2523+
25212524
await host.StopAsync();
25222525
}
25232526
}

0 commit comments

Comments
 (0)