Guides / Compute
Wake a process on a timer or a schedule
A process normally sleeps until a frame arrives. This guide covers the two things that wake it without a frame: a timer the program sets for itself, and schedules declared on the process.
Access is by invitation. To ask for it, write to us.
Timers set by the program
A program calls set-timer(id, at) to be woken later, for example for a retransmission, a lease that expires or a delay it computed. at is a value of now. A process can have up to 16 timers, and setting an id again replaces it.
- A timer never fires early, and fires once. If the process was busy or suspended, or its host was restarted past the time, the timer fires once, late, as soon as the process can run. Missed timers are never replayed one per missed instant.
- When a timer fires, the program's
timer(id)handler runs. It usually does the work and sets the next timer.
Schedules declared on the process
A schedule is for work on a fixed rhythm, such as a nightly job or a heartbeat every 30 seconds. It belongs to the process, not to the program, so it ticks even if the program never ran or lost its state.
spec:
programRef: {name: collector}
schedules:
- {name: heartbeat, everySeconds: 30}
- {name: nightly, cron: "0 3 * * *"} # 03:00 UTC every day
- {name: ticks, everySeconds: 3600, startsAt: "2026-01-01T00:00:00Z"}
| Field | Meaning |
|---|---|
name | A DNS label, unique in the process. The program receives it with each tick. |
cron | Five fields in UTC: minute, hour, day of month, month, day of week. Numbers, lists (1,15), ranges (1-5) and steps (*/10). As in classic cron, if both day fields are restricted a day matching either runs. |
everySeconds | 1 to 86400. Ticks at startsAt plus a multiple of the interval. |
startsAt | An RFC 3339 time for everySeconds; filled in with the creation time when you leave it out, so the rhythm stays put when you edit the process. |
Set exactly one of cron and everySeconds. At most 8 schedules per process.
When a tick arrives late
Ticks are coalesced. A process that was suspended or overloaded gets one tick, not a burst. scheduled(name, due, missed) receives the time the tick was due and how many later ticks were skipped (missed, 0 when on time). If your program cares about every instant, it can compute them from due and missed.
What runs first when several things are due
When several things are due together they run in one activation, in this order: start (a new life), schedule ticks (oldest first), timers (oldest first), frames. A process is woken at most 100 times a second, so a very fast timer or schedule is spread out, not dropped.
To see when the process will wake next, read its status: kubectl get process NAME -o jsonpath='{.status.nextWake}'.
Clean up
To remove a schedule, delete its entry from spec.schedules and apply the process again. To remove everything, delete the process (kubectl delete process NAME).
Next
Balance traffic and accept it at the edge, or store objects in a bucket.