Write a duration
A duration is a count and a unit:30 seconds, 15 minutes, 2 hours, 3 days, 1 week, 6 months, 1 year. The unit can be singular or plural, and a sleep lasts up to a year.
Seconds, minutes, hours, days, and weeks are fixed lengths of time. Months and years follow the calendar: 1 month from January 15 ends on February 15. A month from January 31 runs past the end of February and ends in early March.
When the run wakes up
Nelkap wakes sleeping runs every minute, so a run goes on within a minute after its time is up. A sleep of a few seconds therefore lasts up to a minute. For a pause shorter than that, wait in your code inside a step instead. When the run wakes, Nelkap calls your app, and your workflow runs from the top: the steps before the sleep give back their saved results, the sleep is over, and the work after it runs.Sleep until a date
step.sleep takes a duration. To sleep until a date, work out the duration in a step, so every call of the run gets the same one:
0 hours, and a sleep of zero goes on at once.
How sleeps are saved
A sleep is saved like a step, named after its duration. When a run reaches two sleeps of1 day, the first matches the first saved one, and the second matches the second. So changing a sleep’s duration in your code makes it a new sleep for the runs that already passed it. See Change a workflow safely.