|
57 | 57 | import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; |
58 | 58 | import software.amazon.awssdk.core.exception.ApiCallAttemptTimeoutException; |
59 | 59 | import software.amazon.awssdk.core.exception.SdkClientException; |
| 60 | +import software.amazon.awssdk.core.retry.RetryMode; |
60 | 61 | import software.amazon.awssdk.http.HttpStatusCode; |
61 | 62 | import software.amazon.awssdk.http.async.SdkAsyncHttpClient; |
62 | 63 | import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient; |
@@ -309,21 +310,23 @@ public CompletableFuture<Void> doDeleteObjects(List<String> objectKeys) { |
309 | 310 | .delete(Delete.builder().objects(toDeleteKeys).build()) |
310 | 311 | .build(); |
311 | 312 |
|
312 | | - CompletableFuture<Void> cf = new CompletableFuture<>(); |
313 | | - this.writeS3Client.deleteObjects(request) |
314 | | - .thenAccept(resp -> { |
315 | | - try { |
316 | | - checkDeleteObjectsResponse(resp); |
317 | | - cf.complete(null); |
318 | | - } catch (Throwable ex) { |
| 313 | + return retryOnThrottle(() -> { |
| 314 | + CompletableFuture<Void> cf = new CompletableFuture<>(); |
| 315 | + writeS3Client.deleteObjects(request) |
| 316 | + .thenAccept(resp -> { |
| 317 | + try { |
| 318 | + checkDeleteObjectsResponse(resp); |
| 319 | + cf.complete(null); |
| 320 | + } catch (Throwable ex) { |
| 321 | + cf.completeExceptionally(ex); |
| 322 | + } |
| 323 | + }) |
| 324 | + .exceptionally(ex -> { |
319 | 325 | cf.completeExceptionally(ex); |
320 | | - } |
321 | | - }) |
322 | | - .exceptionally(ex -> { |
323 | | - cf.completeExceptionally(ex); |
324 | | - return null; |
325 | | - }); |
326 | | - return cf; |
| 326 | + return null; |
| 327 | + }); |
| 328 | + return cf; |
| 329 | + }, S3Operation.DELETE_OBJECTS, 0); |
327 | 330 | } |
328 | 331 |
|
329 | 332 | @Override |
@@ -438,6 +441,7 @@ protected ClientOverrideConfiguration clientOverrideConfiguration(long apiCallTi |
438 | 441 | return ClientOverrideConfiguration.builder() |
439 | 442 | .apiCallTimeout(Duration.ofMillis(apiCallTimeoutMs)) |
440 | 443 | .apiCallAttemptTimeout(Duration.ofMillis(apiCallAttemptTimeoutMs)) |
| 444 | + .retryStrategy(RetryMode.STANDARD) |
441 | 445 | .build(); |
442 | 446 | } |
443 | 447 |
|
|
0 commit comments