You are correct if you start your workflow exec with a cron schedule the first execution is going to be created and started right away but your workflow code exec won’t start till the cron timer fires.
One way you could do this is:
-
Start your wf execution without setting cron, have workflow function take for example some boolean “isfirst” param, set it to true
-
Before your workflow completes check isFirst flag, if true start async child workflow (of the same workflow type) with abandoned parent close policy (see here for more info on that) and set the CronSchedule in ChildWorkflowOptions. Also pass false as isFirst so wf code will bypass starting the child workflow again.
This way you would have an execution right away and then again according to the set CronSchedule in ChildWorkflowOptions.