Skip to content

Commit

Permalink
DatastoreStorage.apply_commit: set NDB transaction retries to 10
Browse files Browse the repository at this point in the history
retry aggressively because repo writes can be bursty and cause high
contention. (ndb does exponential backoff.)

https://console.cloud.google.com/errors/detail/CKbL5KSX98uZHw;time=P1D;locations=global?project=bridgy-federated
  • Loading branch information
snarfed committed Dec 4, 2024
1 parent bcddc9a commit 5a57af5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arroba/datastore_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,10 @@ def write(self, repo_did, obj, seq=None):
return AtpBlock.create(repo_did=repo_did, data=obj, seq=seq).to_block()

@ndb_context
@ndb.transactional()
# retry aggressively because repo writes can be bursty and cause high
# contention. (ndb does exponential backoff.)
# https://console.cloud.google.com/errors/detail/CKbL5KSX98uZHw;time=P1D;locations=global?project=bridgy-federated
@ndb.transactional(retries=10)
def apply_commit(self, commit_data):
commit = commit_data.commit.decoded
if repo := AtpRepo.get_by_id(commit['did']):
Expand Down

0 comments on commit 5a57af5

Please sign in to comment.