Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3324608
D13570.id44856.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13570.id44856.diff
View Options
diff --git a/services/identity/src/database/one_time_keys.rs b/services/identity/src/database/one_time_keys.rs
--- a/services/identity/src/database/one_time_keys.rs
+++ b/services/identity/src/database/one_time_keys.rs
@@ -311,16 +311,12 @@
operations.extend_from_slice(¬if_otk_requests);
operations.extend_from_slice(&update_and_delete_otk_count_operation);
- // TODO: Introduce `transact_write_helper` similar to `batch_write_helper`
- // in `comm-lib` to handle transactions with retries
- let mut attempt = 0;
-
+ let retry_config = ExponentialBackoffConfig {
+ max_attempts: retry::MAX_ATTEMPTS as u32,
+ ..Default::default()
+ };
+ let mut exponential_backoff = retry_config.new_counter();
loop {
- attempt += 1;
- if attempt > retry::MAX_ATTEMPTS {
- return Err(Error::MaxRetriesExceeded);
- }
-
let transaction = self
.client
.transact_write_items()
@@ -335,6 +331,7 @@
let retryable_codes = HashSet::from([retry::TRANSACTION_CONFLICT]);
if is_transaction_retryable(&dynamo_db_error, &retryable_codes) {
info!("Encountered transaction conflict while uploading one-time keys - retrying");
+ exponential_backoff.sleep_and_retry().await?;
} else {
error!(
errorType = error_types::OTK_DB_LOG,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 4:42 AM (21 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2553379
Default Alt Text
D13570.id44856.diff (1 KB)
Attached To
Mode
D13570: [identity] Add exponential backoff to upload_one_time_keys
Attached
Detach File
Event Timeline
Log In to Comment