@@ -245,7 +245,7 @@ final class S3ClientSettings {
245245 /**
246246 * The maximum time for a single attempt of an API operation
247247 */
248- final int apiCallTimeoutMillis ;
248+ final TimeValue apiCallTimeout ;
249249
250250 /** Whether the s3 client should use path style access. */
251251 final boolean pathStyleAccess ;
@@ -272,7 +272,7 @@ private S3ClientSettings(
272272 long connectionMaxIdleTimeMillis ,
273273 int maxConnections ,
274274 int maxRetries ,
275- int apiCallTimeoutMillis ,
275+ TimeValue apiCallTimeout ,
276276 boolean pathStyleAccess ,
277277 boolean disableChunkedEncoding ,
278278 boolean addPurposeCustomQueryParameter ,
@@ -290,7 +290,7 @@ private S3ClientSettings(
290290 this .connectionMaxIdleTimeMillis = connectionMaxIdleTimeMillis ;
291291 this .maxConnections = maxConnections ;
292292 this .maxRetries = maxRetries ;
293- this .apiCallTimeoutMillis = apiCallTimeoutMillis ;
293+ this .apiCallTimeout = apiCallTimeout ;
294294 this .pathStyleAccess = pathStyleAccess ;
295295 this .disableChunkedEncoding = disableChunkedEncoding ;
296296 this .addPurposeCustomQueryParameter = addPurposeCustomQueryParameter ;
@@ -320,9 +320,7 @@ S3ClientSettings refine(Settings repositorySettings) {
320320 );
321321 final int newMaxConnections = getRepoSettingOrDefault (MAX_CONNECTIONS_SETTING , normalizedSettings , maxConnections );
322322 final int newMaxRetries = getRepoSettingOrDefault (MAX_RETRIES_SETTING , normalizedSettings , maxRetries );
323- final int newApiCallTimeoutMillis = Math .toIntExact (
324- getRepoSettingOrDefault (API_CALL_TIMEOUT_SETTING , normalizedSettings , TimeValue .timeValueMillis (apiCallTimeoutMillis )).millis ()
325- );
323+ final TimeValue newApiCallTimeout = getRepoSettingOrDefault (API_CALL_TIMEOUT_SETTING , normalizedSettings , apiCallTimeout );
326324 final boolean newPathStyleAccess = getRepoSettingOrDefault (USE_PATH_STYLE_ACCESS , normalizedSettings , pathStyleAccess );
327325 final boolean newDisableChunkedEncoding = getRepoSettingOrDefault (
328326 DISABLE_CHUNKED_ENCODING ,
@@ -375,7 +373,7 @@ S3ClientSettings refine(Settings repositorySettings) {
375373 newConnectionMaxIdleTimeMillis ,
376374 newMaxConnections ,
377375 newMaxRetries ,
378- newApiCallTimeoutMillis ,
376+ newApiCallTimeout ,
379377 newPathStyleAccess ,
380378 newDisableChunkedEncoding ,
381379 newAddPurposeCustomQueryParameter ,
@@ -485,7 +483,7 @@ static S3ClientSettings getClientSettings(final Settings settings, final String
485483 getConfigValue (settings , clientName , CONNECTION_MAX_IDLE_TIME_SETTING ).millis (),
486484 getConfigValue (settings , clientName , MAX_CONNECTIONS_SETTING ),
487485 getConfigValue (settings , clientName , MAX_RETRIES_SETTING ),
488- Math . toIntExact ( getConfigValue (settings , clientName , API_CALL_TIMEOUT_SETTING ). millis () ),
486+ getConfigValue (settings , clientName , API_CALL_TIMEOUT_SETTING ),
489487 getConfigValue (settings , clientName , USE_PATH_STYLE_ACCESS ),
490488 getConfigValue (settings , clientName , DISABLE_CHUNKED_ENCODING ),
491489 getConfigValue (settings , clientName , ADD_PURPOSE_CUSTOM_QUERY_PARAMETER ),
@@ -508,7 +506,7 @@ public boolean equals(final Object o) {
508506 && Objects .equals (connectionMaxIdleTimeMillis , that .connectionMaxIdleTimeMillis )
509507 && maxConnections == that .maxConnections
510508 && maxRetries == that .maxRetries
511- && apiCallTimeoutMillis == that .apiCallTimeoutMillis
509+ && apiCallTimeout == that .apiCallTimeout
512510 && Objects .equals (credentials , that .credentials )
513511 && Objects .equals (protocol , that .protocol )
514512 && Objects .equals (endpoint , that .endpoint )
@@ -535,7 +533,7 @@ public int hashCode() {
535533 readTimeoutMillis ,
536534 connectionMaxIdleTimeMillis ,
537535 maxRetries ,
538- apiCallTimeoutMillis ,
536+ apiCallTimeout ,
539537 maxConnections ,
540538 disableChunkedEncoding ,
541539 addPurposeCustomQueryParameter ,
@@ -560,6 +558,6 @@ static final class Defaults {
560558 static final TimeValue CONNECTION_MAX_IDLE_TIME = TimeValue .timeValueSeconds (60 );
561559 static final int MAX_CONNECTIONS = 50 ;
562560 static final int RETRY_COUNT = 3 ;
563- static final TimeValue API_CALL_TIMEOUT = TimeValue .ZERO ; // default to no API call timeout
561+ static final TimeValue API_CALL_TIMEOUT = TimeValue .MINUS_ONE ; // default to no API call timeout
564562 }
565563}
0 commit comments