sigildocs

(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-handleprocedure

Construct a later-handle struct.

later-handle?procedure

Test if a value is a later-handle struct.

Get the name field of a later-handle struct.

Get the cancelled field of a later-handle struct.

Set the cancelled field of a later-handle struct.

later-every!procedure

Schedule 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!procedure

Schedule 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!procedure

Schedule 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!procedure

Cancel 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.