test: cover targeted and expired ledger claims

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-09-12 13:30:50 +00:00
committed by GitHub
co-authored by genichin
parent 0b5b4660e5
commit f801c53e0c
4 changed files with 40 additions and 8 deletions
+5 -2
View File
@@ -747,8 +747,11 @@ class PostgreSQLLedgerOutbox:
if expected_claim_expires_at is None:
where += "AND claim_owner IS NULL AND claim_expires_at IS NULL"
else:
where += "AND claim_owner=%s AND claim_expires_at=%s"
params.extend([self._worker_id, expected_claim_expires_at])
where += (
"AND claim_owner=%s "
"AND (claim_expires_at=%s OR (status='pending' AND claim_expires_at<=%s))"
)
params.extend([self._worker_id, expected_claim_expires_at, self._now()])
cur.execute(
"UPDATE ledger_outbox SET status=%s, attempts=attempts+%s, "
"last_outcome=%s, last_error=%s, next_retry_at=%s, updated_at=%s, "