Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore]: Add backoff and jitter to Emily internal retry #1277

Open
matteojug opened this issue Jan 27, 2025 · 0 comments
Open

[Chore]: Add backoff and jitter to Emily internal retry #1277

matteojug opened this issue Jan 27, 2025 · 0 comments

Comments

@matteojug
Copy link
Collaborator

Chore - Add backoff and jitter to Emily internal retry

1. Description

In Emily we had a retry mechanism in case we hit version conflict when updating records on DynamoDB:

for _ in 0..retries {
// Get original deposit entry.
let deposit_entry = get_deposit_entry(context, &update.key).await?;
// Return the existing entry if no update is necessary.
if update.is_unnecessary(&deposit_entry) {
return Ok(deposit_entry);
}
// Make the update package.
let update_package: DepositUpdatePackage =
DepositUpdatePackage::try_from(&deposit_entry, update.clone())?;
// Attempt to update the deposit.
match update_deposit(context, &update_package).await {
Err(Error::VersionConflict) => {
// Retry.
continue;
}
otherwise => {
return otherwise;
}
}
}
// Failed to update due to a version conflict
Err(Error::VersionConflict)

(also happens in add_chainstate_entry_with_retry and pull_and_update_withdrawal_with_retry).

We should add some backoff and jitter to reduce congestion and machine load.

@matteojug matteojug added this to sBTC Jan 27, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in sBTC Jan 27, 2025
@matteojug matteojug added this to the sBTC: Nice to have milestone Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant