test: cover targeted and expired ledger claims
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
0b5b4660e5
commit
f801c53e0c
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user