feat: add ledger backfill command
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
f124e9509c
commit
e2c4bbba34
@@ -68,3 +68,18 @@ def test_writer_retries_until_success():
|
||||
now["t"] += timedelta(seconds=600) # past the backoff window
|
||||
s2 = writer.run_once()
|
||||
assert s2.completed == 1 and ledger.count() == 1
|
||||
|
||||
|
||||
def test_process_correlation_id_only_drains_requested_row():
|
||||
outbox = InMemoryLedgerOutbox()
|
||||
ledger = InMemoryLedger()
|
||||
writer = LedgerWriter(outbox, ledger)
|
||||
first = outbox.enqueue(_trade(execution_id="e-1"))
|
||||
second = outbox.enqueue(_trade(execution_id="e-2"))
|
||||
|
||||
outcome = writer.process_correlation_id(first.correlation_id)
|
||||
|
||||
assert outcome is OutboxOutcome.COMPLETED
|
||||
assert ledger.count() == 1
|
||||
assert outbox.get(first.correlation_id).status is WorkItemStatus.COMPLETED
|
||||
assert outbox.get(second.correlation_id).status is WorkItemStatus.PENDING
|
||||
|
||||
Reference in New Issue
Block a user