Skip to content

Commit

Permalink
patch: restores timeout length, perpetuates interruptions (awslabs#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
markjschreiber authored and stefanofornari committed May 20, 2024
1 parent e1b5c6e commit 9648bee
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package software.amazon.nio.spi.s3;

import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
import static software.amazon.nio.spi.s3.util.TimeOutUtils.TIMEOUT_TIME_LENGTH_1;
import static software.amazon.nio.spi.s3.util.TimeOutUtils.TIMEOUT_TIME_LENGTH_3;
import static software.amazon.nio.spi.s3.util.TimeOutUtils.logAndGenerateExceptionOnTimeOut;

import java.net.URI;
Expand Down Expand Up @@ -90,7 +88,10 @@ void universalClient(S3AsyncClient client) {
protected S3AsyncClient generateClient(String bucket) {
try {
return generateClient(bucket, S3AsyncClient.create());
} catch (ExecutionException | InterruptedException e) {
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
Expand Down Expand Up @@ -131,7 +132,7 @@ private String getBucketLocation(String bucketName, S3AsyncClient locationClient
try (var client = locationClient) {
final HeadBucketResponse response = client
.headBucket(builder -> builder.bucket(bucketName))
.get(TIMEOUT_TIME_LENGTH_3, SECONDS);
.get(TIMEOUT_TIME_LENGTH_1, MINUTES);
return response.bucketRegion();

} catch (TimeoutException e) {
Expand Down

0 comments on commit 9648bee

Please sign in to comment.