I’ve encountered a strange behavior when using Workflow Update method. According to the documentation Update handler can execute Activities and Child Workflows so my update executes a new child workflow (ExecuteChildWorkflowAsync).
When the update gets called the child workflow starts and all seems to work great (the workflow itself simply prints hello to the console and exits).
When I check the dashboard the child workflow it marked as completed, but when I click on the link itself (of the child WF in the dashboard) the child workflow is executed again ?! Every time I’m accessing the URL it starts, and not via the parent flow update method - verified with the debugger, so something else is triggering it.
Visiting the UI should not be executing the child workflow again, but it may be replaying it to fetch information via workflow query. Replay does re-execute code but does not re-run any of the side effects. This is expected behavior since the UI issues a query to get user metadata.
Thank you for the explanation.
I just want to make sure that the behavior in my case is the expected one - I do see a console printout from my sub workflow. So although there is no side effect the workflow will re-run each time I access it via UI ?
Yes, the code to build up the workflow to answer the query from the UI is technically running in a process we call “replay”, but it should be transparent to you since it should be side effect free. You should consider using Workflow.Logger in your workflows instead of Console because the former is replay-safe and the latter is not.