We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

GuideSleeps

Durable Sleep

A durable task can elect to sleep for either a specified period of time or until a provided time, which pauses task execution. While the task is sleeping, no resources are consumed, and the task can also be evicted in order to free the worker slot.

Unlike a language-level sleep (e.g. time.sleep in Python or setTimeout in Node), durable sleep is guaranteed to respect the original duration across interruptions of the durable task, worker crashes, and so on. A language-level sleep ties the wait to the local process, so if the process restarts, the sleep starts over from scratch.

Using durable sleep

The DurableContext exposes helper methods to allow you to sleep for either a specific duration of time, or until a certain time.