Versioning for workflow Sleep and AwaitWithTimeout with duration change

We have a situation where we use AwaitWithTimeout and change the wait duration and we are seeing the NonDeterministicError from the workflows which run with previous duration value.

nondeterministic workflow: extra replay command for ScheduleActivityTask: (ActivityId:18, ActivityType:(Name:SendToKafkaActivity), TaskQueue:(Name:REQUISITION_CPO_QUEUE, Kind:Normal), Header:(Fields:map[]), Input:(Payloads:[len=2]), ScheduleToCloseTimeout:0s, ScheduleToStartTimeout:0s, StartToCloseTimeout:5m0s, HeartbeatTimeout:0s, RetryPolicy:(InitialInterval:1s, BackoffCoefficient:2, MaximumInterval:1m0s, MaximumAttempts:10, NonRetryableErrorTypes:[len=0]), RequestEagerExecution:true

Where as on the other hand, when we use the Sleep, and change the wait duration, we don’t see any error for the old and new workflows. It is all successful and the workflows are completed.

Based on this link below at the Sanity Checking, both AwaitWithTimeout and Sleep, both seem to require versioning.

Is this normal and if we do use AwaitWithTimeout, should we use versioning? And, how would versioning work in which duration is dynamic and the if-else conditions continue to grow.

You don’t need versioning if the duration calculation doesn’t change. If it changes then that part should be versioned.

If you just hardcode the duration value then any change of it should be versioned.

Thanks Maxim, based on our test, when using a workflow.sleep and changing that duration while workflows with old duration are still waiting, doesn’t manifest the non-determinism. Is this ok?

It is OK unless you change between zero and non zero duration.