Skip to main content

Module crons

Module crons 

Source
Expand description

The cron cluster on Workspace: the durable-cron store accessor and its mutation helpers, the asleep-slot prompt buffers, the fire router, the scheduler task, and the cross-crate seed helper.

Everything here stays on Workspace as a second impl block, so every caller (the boot path in crate::workspace, the mcp::cron facade, spawn::deliver_cron_prompt, a view’s boot) keeps its path. The crons and update_tx fields these methods own are pub(crate) for the same reason db is: so this sibling module can reach them without a wrapper. A fired cron with no live session parks in crate::parked. Schedule math lives in crate::mcp::cron::schedule; the MCP tool surface in crate::mcp::cron; delivery in crate::spawn.

Re-exportsΒ§

use std::sync::Arc; πŸ”’
use std::time::Duration; πŸ”’
use tracing::Instrument; πŸ”’
use crate::protocol::SessionUpdate; πŸ”’
use crate::target::ProjectKey; πŸ”’
use crate::workspace::Workspace; πŸ”’

StructsΒ§

PendingCron πŸ”’
A cron prompt buffered for a sleeping slot: the raw prompt plus whether this fire is overdue (delivered with a missed marker on drain), and the entry’s identity, which the drained echo names.

ConstantsΒ§

COOLING_REWARN_INTERVAL πŸ”’
The gap between warnings while one cooling episode lasts; the ticks in between repeat at debug.
CRON_TICK_INTERVAL πŸ”’
How often the cron scheduler wakes to fire due crons. Minute granularity matches the cron-expression resolution.
IST_OFFSET_MINUTES πŸ”’
India Standard Time’s offset from UTC, the clock a reader of the notice is on.

FunctionsΒ§

cooling_reset_text πŸ”’
The reset a deferred cron names: the wall clock in IST plus the wait ahead, so a reader needs no arithmetic on a duration. A reset no clock can spell falls back to the wait alone rather than panicking the scheduler.
wait_text πŸ”’
A wait as the two largest units that describe it (β€œ1h 5m”, β€œ3m 20s”).