danielgerlag / workflow-core

Lightweight workflow engine for .NET Standard
MIT License
5.4k stars 1.2k forks source link

Fix sending of workflow completed event #1201

Open mamidenn opened 1 year ago

mamidenn commented 1 year ago

Describe the change As described in #1097 a workflow that ends in an EndStep does not lead to the WorkflowCompleted LifeCycleEvent being published because DetermineNextExecutionTime returns too early. This PR remedies that by sending the event also in case of an early return from DetermineNextExecutionTime.

Describe your implementation or design Extracted publishing of WorkflowCompleted into a separate method and added a call to that function before the early return if workflow is completed.

Tests Yes, added a failing unit test that is green after the implementation is changed.

Breaking change No

Additional context