Add retry logic to S3 metadata#41
Conversation
…f S3 head object results.
There was a problem hiding this comment.
Code Review
This pull request enhances the getObjectMetadata function in the storage service by implementing a retry mechanism to handle S3's eventual consistency and transient 404 errors. The changes include new utility functions for metadata validation and error handling, supported by updated unit tests. A review comment suggests adopting an exponential backoff strategy for the retry delay to optimize performance and resource usage.
| } | ||
|
|
||
| if (attempt < maxAttempts) { | ||
| await wait(retryDelayMs); |
There was a problem hiding this comment.
Using a fixed retry delay can be inefficient or lead to unnecessary load during transient failures. Implementing an exponential backoff strategy is generally a best practice for retries, especially when dealing with eventual consistency in cloud services like S3.
| await wait(retryDelayMs); | |
| await wait(retryDelayMs * Math.pow(2, attempt - 1)); |
…f S3 head object results.