Skip to content
Français

recoverSpeculation

import { recoverSpeculation } from "@elie-laloum/outpost";

Release the ownership of a durable race whose coordinator has stopped, provided its saved object is still at the given revision; otherwise rejects with TransportConflict. It stops and deletes nothing: the next speculate() call stops registered resources and needs resume: retry-incomplete to replay interrupted candidates.

Complete example and detailed rules.

  • optionsRequired
    SpeculationRecoveryOptions
    Abandoned race identity, inspected revision and explicit confirmation that its coordinator has stopped.
  • options.runIdRequired
    string
    runId of the race to release.
  • options.revisionRequired
    string
    Revision of the saved object as you read it; if it changed since, recovery rejects with TransportConflict.
  • options.coordinatorStoppedRequired
    true
    Explicit confirmation that the old coordinator has stopped; a remote PID or elapsed time is insufficient evidence.
  • options.transporterRequired
    Transport
    Caller-owned object transport used by the store or operation. Closing a workflow or sandbox does not close this transport.

Promise<void>

export declare function recoverSpeculation(
  options: SpeculationRecoveryOptions,
): Promise<void>;