rally_runtime/system
System database: observability and background jobs.
Opens a separate SQLite database (system.db) for message logging and the job queue. The connection is stored globally so any WS handler process can log messages. Uses synchronous=OFF because losing a few recent log entries on crash is acceptable for the throughput gain.
Types
pub type JobHandler =
fn(String, BitArray) -> Result(Nil, String)
Values
pub fn enqueue(
name name: String,
payload payload: BitArray,
run_at run_at: Int,
) -> Nil
Enqueue a job to run at a specific time.
pub fn enqueue_in(
name name: String,
payload payload: BitArray,
delay_seconds delay_seconds: Int,
) -> Nil
Enqueue a job to run after a delay.
pub fn enqueue_now(
name name: String,
payload payload: BitArray,
) -> Nil
Enqueue a job to run immediately.
pub fn start(path: String) -> Nil
Call during app startup. Opens the system DB and stores the connection globally so any process (WS handlers) can access it.
pub fn start_with_jobs(
path path: String,
handler handler: fn(String, BitArray) -> Result(Nil, String),
) -> Nil
Start the system DB with a background job runner.