// schedule:: — unified facade over time:: + scatter:: (process-local timers).
// See docs/SCHEDULE.md
//
// Try: dal run examples/schedule_stdlib.dal
// Long-lived: dal serve examples/schedule_stdlib.dal --port 4040
// curl -s http://127.0.0.1:4040/health
fn main() {
let now = time::unix_ms_now();
log::info("sched_demo", "now_ms=" + to_string(now));
schedule::once_after_ms("hello", 500);
schedule::every_minutes("tick", 60);
let ids = schedule::series_interval_from_now_ms("burst", 1000, 3);
log::info("sched_demo", "series ids: " + json::stringify(ids));
}
@route("GET", "/health")
fn health(_request) {
let due = schedule::pending();
return {
"status": 200,
"headers": { "Content-Type": "application/json" },
"body": json::stringify({
"ok": true,
"due_this_poll": due,
"scheduled": schedule::scheduled_count(),
"next_ms": schedule::next_due_ms(),
}),
};
}
main();