Skip to content

Commit

Permalink
Fix setitem loop now that we use Dynamo retry config. Update number f…
Browse files Browse the repository at this point in the history
…or retries in test assertion
  • Loading branch information
KaspariK committed Jan 20, 2025
1 parent 3e74d75 commit f88d7f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/serialize/runstate/dynamodb_state_store_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def test_retry_reading(self, store, small_object, large_object):
):
store.restore(keys)
except Exception:
assert_equal(mock_failed_read.call_count, 11)
assert_equal(mock_failed_read.call_count, 10)

def test_restore_exception_propagation(self, store, small_object):
# This test is to ensure that restore propagates exceptions upwards: see DAR-2328
Expand Down
4 changes: 3 additions & 1 deletion tron/serialize/runstate/dynamodb_state_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ def __setitem__(self, key: str, value: Tuple[bytes, str]) -> None:

items.append(item)

while len(items) == MAX_TRANSACT_WRITE_ITEMS or index == max_partitions - 1:
# We want to write the items when we've either reached the max number of items
# for a transaction, or when we're done processing all partitions
if len(items) == MAX_TRANSACT_WRITE_ITEMS or index == max_partitions - 1:
try:
self.client.transact_write_items(TransactItems=items)
items = []
Expand Down

0 comments on commit f88d7f9

Please sign in to comment.