Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F31999606
D15510.1764952172.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15510.1764952172.diff
View Options
diff --git a/shared/comm-lib/src/database.rs b/shared/comm-lib/src/database.rs
--- a/shared/comm-lib/src/database.rs
+++ b/shared/comm-lib/src/database.rs
@@ -549,15 +549,12 @@
}
Err(error) => {
let error: DynamoDBError = error.into();
- if !matches!(
- error,
- DynamoDBError::ProvisionedThroughputExceededException(_)
- ) {
+ if !is_retryable_dynamodb_error(&error) {
tracing::error!("BatchGetItem failed: {0:?} - {0}", error);
return Err(error.into());
}
- tracing::warn!("Provisioned capacity exceeded!");
+ tracing::warn!("Retryable DynamoDB error: {}", error);
if !config.retry_on_provisioned_capacity_exceeded {
return Err(error.into());
}
@@ -637,12 +634,12 @@
}
}
Err(error) => {
- if !is_provisioned_capacity_exceeded(&error) {
+ if !is_retryable_batch_write_error(&error) {
tracing::error!("BatchWriteItem failed: {0:?} - {0}", error);
return Err(super::Error::AwsSdk(error.into()));
}
- tracing::warn!("Provisioned capacity exceeded!");
+ tracing::warn!("Retryable BatchWriteItem error: {}", error);
if !config.retry_on_provisioned_capacity_exceeded {
return Err(super::Error::AwsSdk(error.into()));
}
@@ -657,9 +654,18 @@
Ok(())
}
- /// Check if transaction failed due to
- /// `ProvisionedThroughputExceededException` exception
- fn is_provisioned_capacity_exceeded(
+ /// Check if DynamoDB error is retryable with exponential backoff
+ pub fn is_retryable_dynamodb_error(err: &DynamoDBError) -> bool {
+ matches!(
+ err,
+ DynamoDBError::ProvisionedThroughputExceededException(_)
+ | DynamoDBError::ThrottlingException(_)
+ | DynamoDBError::RequestLimitExceeded(_)
+ )
+ }
+
+ /// Check if BatchWriteItem error is retryable with exponential backoff
+ pub fn is_retryable_batch_write_error(
err: &SdkError<BatchWriteItemError>,
) -> bool {
let SdkError::ServiceError(service_error) = err else {
@@ -668,6 +674,8 @@
matches!(
service_error.err(),
BatchWriteItemError::ProvisionedThroughputExceededException(_)
+ | BatchWriteItemError::ThrottlingException(_)
+ | BatchWriteItemError::RequestLimitExceeded(_)
)
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 5, 4:29 PM (2 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5823688
Default Alt Text
D15510.1764952172.diff (2 KB)
Attached To
Mode
D15510: [comm-lib] retry `ThrottlingException` and `RequestLimitExceeded`
Attached
Detach File
Event Timeline
Log In to Comment