Skip to content

Commit 977d8cd

Browse files
committed
update restart logic at inmemoryorchestrationservice
1 parent dd6f8f4 commit 977d8cd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/Grpc.IntegrationTests/GrpcDurableTaskClientIntegrationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ public async Task RestartAsync_EndToEnd(bool restartWithNewInstanceId)
265265
using var completionCts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
266266
await server.Client.WaitForInstanceCompletionAsync(restartedInstanceId, completionCts.Token);
267267

268-
// Verify the restarted orchestration completed
268+
// Verify the restarted orchestration completed.
269+
// Also verify input and orchestrator name are matched.
269270
var restartedMetadata = await server.Client.GetInstanceAsync(restartedInstanceId, true);
270271
restartedMetadata.Should().NotBeNull();
271272
restartedMetadata!.Name.Should().Be(OrchestrationName);

test/Grpc.IntegrationTests/GrpcSidecar/InMemoryOrchestrationService.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,8 @@ public void AddMessage(TaskMessage message)
451451
// For restart scenarios, clear the history and reset the state
452452
if (isRestart && state.IsCompleted)
453453
{
454-
state.HistoryEventsJson.Clear();
455-
state.ExecutionId = executionId; // Always update the execution ID
456-
state.IsCompleted = false;
457-
state.IsLoaded = false; // Reset the loaded state for restart scenarios
454+
state.ExecutionId = executionId;
455+
state.IsLoaded = false;
458456
}
459457

460458
OrchestrationState newStatusRecord = new()
@@ -471,6 +469,7 @@ public void AddMessage(TaskMessage message)
471469
};
472470

473471
state.StatusRecordJson = JsonValue.Create(newStatusRecord);
472+
state.HistoryEventsJson.Clear();
474473
state.IsCompleted = false;
475474
}
476475
else if (state.IsCompleted)

0 commit comments

Comments
 (0)