# Versioning for workflow Sleep and AwaitWithTimeout with duration change

**URL:** <https://community.temporal.io/t/versioning-for-workflow-sleep-and-awaitwithtimeout-with-duration-change/6517>\
**Category:** Community Support\
**Tags:** go-sdk\
**Created:** [November 17, 2022, 8:54pm UTC](https://community.temporal.io/t/versioning-for-workflow-sleep-and-awaitwithtimeout-with-duration-change/6517 "2022-11-17T20:54:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sampath\_Boddeti](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/sampath_boddeti/32/3015_2.png) [@Sampath\_Boddeti](https://community.temporal.io/u/Sampath_Boddeti)\
**Post date:** [November 17, 2022, 8:54pm UTC](https://community.temporal.io/t/versioning-for-workflow-sleep-and-awaitwithtimeout-with-duration-change/6517/1 "2022-11-17T20:54:30Z")

</div>

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.

```auto
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.

> **[Versioning | Temporal Documentation](https://docs.temporal.io/go/versioning)**
>
> The definition code of a Temporal Workflow must be deterministic because Temporal uses event sourcing

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [November 17, 2022, 10:33pm UTC](https://community.temporal.io/t/versioning-for-workflow-sleep-and-awaitwithtimeout-with-duration-change/6517/2 "2022-11-17T22:33:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sampath\_Boddeti](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/sampath_boddeti/32/3015_2.png) [@Sampath\_Boddeti](https://community.temporal.io/u/Sampath_Boddeti)\
**Post date:** [November 18, 2022, 2:46pm UTC](https://community.temporal.io/t/versioning-for-workflow-sleep-and-awaitwithtimeout-with-duration-change/6517/3 "2022-11-18T14:46:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [November 18, 2022, 9:04pm UTC](https://community.temporal.io/t/versioning-for-workflow-sleep-and-awaitwithtimeout-with-duration-change/6517/4 "2022-11-18T21:04:01Z")

</div>

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