Sanity Library Reference Docs
    Preparing search index...
    • Release every pending-effect claim whose lease has expired, and re-arm every entry no drain has claimed for DEFAULT_EFFECT_LEASE_MS, so a drain picks each of them up. A released claim gets an effectClaimReleased audit row; a re-armed entry gets a fresh queuedAt and no row. An entry is re-armed at most once per DEFAULT_EFFECT_LEASE_MS.

      One CAS write per call; concurrent sweeps and drains are safe, and a sweep that loses a race re-reads, then fails after a bounded number of attempts. Dispatching the entries is the next drainEffects call's job. To kill a stuck entry without redispatching, report it via completeEffect({status: 'failed'}) instead.

      Parameters

      • args: {
            client: WorkflowClient;
            clock?: Clock;
            executionContext?: DeclaredExecutionContext;
            instanceId: string;
            partition: string;
        }
        • client: WorkflowClient
        • Optionalclock?: Clock

          Read for the lease and re-arm comparisons and for every stamp. Defaults to the wall clock.

        • OptionalexecutionContext?: DeclaredExecutionContext

          Declared execution context stamped on the release audit rows — a sweeper runtime declares itself here (identity is its token).

        • instanceId: string
        • partition: string

      Returns Promise<SweepStaleClaimsResult>