(sigil later runner)
(sigil later runner) - Async task runner for scheduled tasks.
Each scheduled task spawns its own goroutine that sleeps until the exact fire time, then executes the handler. Tasks are cancellable via the returned handle.
(with-async
;; Recurring: fires every 5 minutes
(later-every! "*/5 * * * *" "check-inbox"
(lambda () (check-inbox)))
;; One-time: fires in 1 hour
(let ((handle (later-after! 3600 "reminder"
(lambda () (send-reminder)))))
;; Cancel it before it fires:
(later-cancel! handle)))Exports
later-handleprocedureConstruct a later-handle struct.
later-handle?procedureTest if a value is a later-handle struct.
later-handle-nameprocedureGet the name field of a later-handle struct.
later-handle-cancelledprocedureGet the cancelled field of a later-handle struct.
set-later-handle-cancelled!procedureSet the cancelled field of a later-handle struct.
later-every!procedureSchedule a recurring task on a cron schedule.
Spawns a goroutine that computes the next matching time via later-next, sleeps until then, fires the handler, and repeats. Returns a handle that can be cancelled.
later-after!procedureSchedule a one-time task after a delay (in seconds).
Spawns a goroutine that sleeps for the delay, then fires. Returns a cancellable handle.
later-at!procedureSchedule a one-time task at a specific Unix timestamp.
Spawns a goroutine that sleeps until the target time, then fires. Returns a cancellable handle.
later-cancel!procedureCancel a scheduled task. If the task hasn't fired yet, it won't. If it's already running, this has no effect on the current execution.