I’m using the code from the tutorial with set CronSchedule: “* * * * */1” in client.StartWorkflowOptions and as expected the workflow is being triggered each minute (I’m running into one issue here, current run is always in Running state even though from logs I can see that all activities already finished, and status is changed to Completed once another workflow run is triggered by the cron).
I can trigger CancelWorkflow or TerminateWorkflow and it will stop the cron to spawn new workflow instances but it will also stop currently running workflow instance and it’s activities.
I tried using ctx, _ = workflow.NewDisconnectedContext(ctx) in TransferMoney workflow definition. In case of terminate, workflow will be moved to Terminated state, current activity will finish but next activity wont be triggered and following error can be found in the logs: Worker Error workflow execution already completed.
If I run cancel with that disconnected context workflow instance won’t be cancelled and new instance will be scheduled by cron.
Is there a way to stop the scheduler but allow current run of the workflow to finish?