fix(workflow-engine): clear pruned loop history via batched, bounded deletes - #5654
Conversation
|
Stack for rivet-dev/actors Get stack: change nrzuuryv |
|
🚅 Deployed to the actors-pr-5654 environment in rivet-frontend
|
…deletes Port of the workflows-repo fix. Add batchDelete to the EngineDriver interface and all implementations, and route loop-history pruning through runDeletes(), which coalesces keys into transaction-sized (MAX_KV_BATCH_ENTRIES) batchDelete chunks run in bounded rounds (MAX_CONCURRENT_DELETES=64). Previously deleteEntriesWithPrefix / flush fanned out one unbounded Promise.all of single-statement deletes per key; cutting a loop history of >128 entries exceeded the actor SQLite transaction coordinator's 128-permit admission cap (non-blocking try_acquire -> transaction_queue_full).
4786f7c to
3dd5055
Compare
|
Review Solid, well-targeted fix for the loop-pruning path. The change correctly identifies and fixes the root cause: Bug: the same unbounded fan-out still exists in
await Promise.all(
entriesToDelete.flatMap(({ entry }) => [
driver.delete(buildHistoryKey(entry.location)),
driver.delete(buildEntryMetadataKey(entry.id)),
]),
);This is structurally identical to the bug this PR fixes elsewhere: one
Correctness (loop-pruning path)
Minor / nit
Test coverage Recommendation: fix or explicitly scope out the |
Port of the workflows-repo fix. Add batchDelete to the EngineDriver
interface and all implementations, and route loop-history pruning through
runDeletes(), which coalesces keys into transaction-sized (MAX_KV_BATCH_ENTRIES)
batchDelete chunks run in bounded rounds (MAX_CONCURRENT_DELETES=64).
Previously deleteEntriesWithPrefix / flush fanned out one unbounded
Promise.all of single-statement deletes per key; cutting a loop history
of >128 entries exceeded the actor SQLite transaction coordinator's
128-permit admission cap (non-blocking try_acquire -> transaction_queue_full).