Skip to content

008 — One in-window pending claim per hostname

Context

Two concurrent in-window claims would mean two challenge codes, racey transfers, and unclear "who won?" UX. A pending claim that has already passed expires_at but is not yet marked failed (e.g. before the next cron tick) should not block a new claimant.

Decision

At most one active pending claim per hostname: status = pending and expires_at > now.

When starting or reviving a claim, if another user's pending claim is past expires_at, fail it first (same transition as cron: claim + claimant user_domainfailed, emit claim.expired), then proceed. In-window competing claims still return CLAIM_IN_PROGRESS.

The partial unique index domain_claims_one_pending_per_domain remains; eager fail keeps at most one pending row.

Consequences

  • No true multi-active parallel claims.
  • New claimants are not stuck waiting for cron after another claim's window ends.
  • Failed claimants can still revive their own claim when no other in-window claim exists.