Skip to main content

spawn_job

Function spawn_job 

Source
pub fn spawn_job<F>(
    pool: DbPool,
    kind: &str,
    actor: &str,
    params: Value,
    body: F,
) -> Result<Uuid, String>
where F: FnOnce(&JobProgress) -> Result<Value, String> + Send + 'static,
Expand description

Spawns a background job: inserts a queued row, returns its uuid, and runs body on a thread. The body reports progress via JobProgress and returns a terminal result or an error message.