Ensure graceful handling of missing ParentInstanceId in ResumeBulkDispatchWorkflowActivity and add signal-based wait in DeleteWorkflowTests.

This commit is contained in:
Sipke Schoorstra 2026-01-30 21:41:27 +01:00
parent 558902bb77
commit 641dd664d6
No known key found for this signature in database
GPG key ID: 5C10502B28A4268F
2 changed files with 7 additions and 1 deletions

View file

@ -26,7 +26,10 @@ internal class ResumeBulkDispatchWorkflowActivity(IBookmarkQueue bookmarkQueue,
if (!waitForCompletion)
return;
var parentInstanceId = (string)workflowState.Properties["ParentInstanceId"];
if (!workflowState.Properties.TryGetValue("ParentInstanceId", out var parentInstanceIdValue))
return;
var parentInstanceId = (string)parentInstanceIdValue;
var activityTypeName = ActivityTypeNameHelper.GenerateTypeName<BulkDispatchWorkflows>();
var stimulus = new BulkDispatchWorkflowsStimulus(parentInstanceId);
var stimulusHash = stimulusHasher.Hash(activityTypeName, stimulus);

View file

@ -36,6 +36,9 @@ public class DeleteWorkflowTests : AppComponentTest
var workflowDefinitionManager = _scope1.ServiceProvider.GetRequiredService<IWorkflowDefinitionManager>();
await workflowDefinitionManager.DeleteByDefinitionIdAsync(Workflows.DeleteWorkflow.DefinitionId);
// Wait for the event handler to process the deletion from the activity registry
await _signalManager.WaitAsync(WorkflowDeletedSignal, 5000);
WorkflowTypeDeletedFromRegistry(_scope1, Workflows.DeleteWorkflow.Type);
}