March Docs

Conduit.CronRegistry

Conduit.CronRegistry — in-process registry mapping cron_type → (performer, config).

Static cron jobs are registered at startup via Conduit.register_cron (which delegates here). Dynamic crons live only in the DB; they are not registered in-process and are fired by the scheduler directly without a registry lookup.

The registry is Vault-backed: each entry is stored under its cron_type key in a named table. Vault.new is idempotent, so the registry is process-global and shared across all callers in the same OS process.

Types

ptypeEntryEntry = {#

Functions

fnallall()#

Return all registered cron entries as a list.

Used by `Conduit.API.start` to upsert static crons into the DB on startup.
Iterates `Vault.keys` to enumerate all registered cron_types, then loads
each entry.  Entries that have been concurrently unregistered are silently
skipped.
fnfirefire(cron_type : String, payload : String)#

Invoke the registered performer for cron_type with payload.

Returns the performer's result, or `Err(ConduitError.Discard(...))` if no
performer is registered for the given cron type.
fnlookuplookup(cron_type : String) : Option(Entry)#

Return the registered entry for cron_type, or None if not registered.

Workers and the cron scheduler use this to retrieve the performer function
and its associated config without re-querying the DB.
fnoverlap_from_stringoverlap_from_string(s : String)#

Deserialise a DB string back to a CronOverlap variant.

Unknown strings default to Skip (the safest policy: don't start a second
instance of the job if the previous one hasn't finished yet).
fnoverlap_to_stringoverlap_to_string(o) : String#

Serialise a CronOverlap variant to its DB string representation.

fnregisterregister(cron_type : String, config : Conduit.CronConfig, performer : String -> Result((), Conduit.ConduitError)) : ()#

Register a cron performer and its config.

Should be called once at application startup for each static cron job.
Calling `register` a second time with the same `cron_type` overwrites the
previous entry — useful for testing but avoid in production.