Skip to main content

settle

Function settle 

Source
pub fn settle(
    work_dir: &Path,
    claimed: &Claimed,
    state: &str,
) -> Result<(), String>
Expand description

What: Move a claimed item to done (or to failed), after the consumer’s result is durable. Why: A crash before this rename leaves the item claimed, and its lease runs out; the work is then done again, so a handler must tolerate a repeat. The rename names the claim’s generation, so a holder whose claim was taken over and claimed again by another settles nothing of the other’s.

In TS you’d write (pseudocode):

await rename(join(workDir, 'claimed', claimed.name), join(workDir, 'done', claimed.id))