Workflow scheduling strategies go-SDK

  1. cancel existing workflow and create another one with the new schedule

This works, but ugly and has race conditions when multiple such requests are executed in parallel.

  1. create a loop which sleeps some increment example per minute, on waking check some schedule value via activity to decide if need to continue to sleep

Busy wait in workflows is usually an antippatern. If you want to check something periodically do it in an activity. See this post that explains how to do polling. In any case I wouldn’t go with this approach for your use case.

I would recommend a loop that blocks on both a timer and a signal using Selector. If the signal is received the time is recalculated, if the timer fired then activities are executed.

1 Like