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
+9 -3
View File
@@ -522,10 +522,16 @@ class InMemoryLedgerOutbox:
*,
correlation_id: str | None = None,
) -> list[LedgerWorkItem]:
pending = self.list_pending(limit if correlation_id is None else max(limit, 1))
if correlation_id is None:
return pending[:limit]
return [row for row in pending if row.correlation_id == correlation_id][:1]
return self.list_pending(limit)
now = self._now()
with self._lock:
row = self._rows.get(correlation_id)
if row is None or row.status is not WorkItemStatus.PENDING:
return []
if row.next_retry_at is not None and row.next_retry_at > now:
return []
return [row]
def pending_cash_delta(self) -> dict[str, float]:
with self._lock: