Skip to main content
A run can stop for a set time, then carry on: a reminder three days after sign-up, a follow-up a week after an order, a retry an hour later. While it sleeps, your app has nothing running and nothing in memory. Nelkap keeps the run, and calls your app again when the time is up.
Started when a trial begins, this run sleeps for 11 days, then sends the reminder.

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:
This run sends its reminder a day before the event. The number of hours is saved, so a later call doesn’t compute a new one from a later time. If the event is less than a day away, the duration is 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 of 1 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.

Cancel a sleeping run

While a run sleeps, you can cancel it from its page, for example when the user upgrades before the trial reminder goes out. See Runs.