Durable Timers - .NET SDK
This page describes how to set a Durable Timer using the Temporal .NET SDK.
A Durable Timer is used to pause the execution of a Workflow for a specified duration. A Workflow can sleep for days or even months. Timers are persisted, so even if your Worker or Temporal Service is down when the time period completes, as soon as your Worker and Temporal Service are back up, the Durable Timer call will resolve and your code will continue executing.
Sleeping is a resource-light operation: it does not tie up the process, and you can run millions of Timers off a single Worker.
To add a Timer in a Workflow, use Workflow.DelayAsync
. This is like a deterministic form of Task.Delay
.
// Sleep for 3 days
await Workflow.DelayAsync(TimeSpan.FromDays(3));