Skip to content

Commit e13fac5

Browse files
committed
CFP-2843 Remove timeout setting again
1 parent 847dbdd commit e13fac5

9 files changed

Lines changed: 15 additions & 21 deletions

File tree

alioss/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ The AliOSS client requires a JSON configuration file with the following structur
1616
"access_key_secret": "<string> (required)",
1717
"endpoint": "<string> (required)",
1818
"bucket_name": "<string> (required)",
19-
"http_request_timeout": "<string duration> (default: '60s')"
19+
"http_request_timeout": "<string duration> (optional)"
2020
}
2121
```
2222

23-
Set `http_request_timeout` to `"0"` to disable the HTTP client timeout explicitly.
23+
If `http_request_timeout` is omitted (or set to `"0"`), the HTTP client timeout is left unset.
2424

2525
**Usage examples:**
2626
``` bash

alioss/config/config.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ type AliStorageConfig struct {
1818

1919
var errorNonPositiveHTTPRequestTimeout = errors.New("http_request_timeout must be greater than 0")
2020

21-
const defaultHTTPRequestTimeoutSeconds int64 = 60
22-
2321
// NewFromReader returns a new ali-storage-cli configuration struct from the contents of reader.
2422
// reader.Read() is expected to return valid JSON
2523
func NewFromReader(reader io.Reader) (AliStorageConfig, error) {
@@ -43,7 +41,7 @@ func NewFromReader(reader io.Reader) (AliStorageConfig, error) {
4341

4442
func (c AliStorageConfig) HTTPRequestTimeoutSeconds() (int64, error) {
4543
if c.HTTPRequestTimeout == "" {
46-
return defaultHTTPRequestTimeoutSeconds, nil
44+
return 0, nil
4745
}
4846

4947
if c.HTTPRequestTimeout == "0" {

alioss/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var _ = Describe("Config", func() {
4949
Expect(timeoutSeconds).To(Equal(int64(2)))
5050
})
5151

52-
It("uses 60 seconds timeout when http_request_timeout is not provided", func() {
52+
It("leaves timeout unset when http_request_timeout is not provided", func() {
5353
configJson := []byte(`{"access_key_id": "foo_access_key_id",
5454
"access_key_secret": "foo_access_key_secret",
5555
"endpoint": "foo_endpoint",
@@ -62,7 +62,7 @@ var _ = Describe("Config", func() {
6262
Expect(config.HTTPRequestTimeout).To(BeEmpty())
6363
timeoutSeconds, err := config.HTTPRequestTimeoutSeconds()
6464
Expect(err).ToNot(HaveOccurred())
65-
Expect(timeoutSeconds).To(Equal(int64(60)))
65+
Expect(timeoutSeconds).To(BeZero())
6666
})
6767

6868
It("returns an error when http_request_timeout has invalid format", func() {

gcs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ The GCS client requires a JSON configuration file.
1717
"credentials_source": "<string> ['static'|'none'|""]",
1818
"json_key": "<string> (required if credentials_source = 'static')",
1919
"storage_class": "<string> (optional - default: 'STANDARD', check for more options=https://docs.cloud.google.com/storage/docs/storage-classes)",
20-
"http_request_timeout": "<string duration> (default: '60s')",
20+
"http_request_timeout": "<string duration> (optional)",
2121
"encryption_key": "<string> (optional)",
2222
"uniform_bucket_level_access": "<boolean> (optional)"
2323
}
2424
```
2525

26-
Set `http_request_timeout` to `"0"` to disable the HTTP client timeout explicitly.
26+
If `http_request_timeout` is omitted (or set to `"0"`), the HTTP client timeout is left unset.
2727

2828
### Credentials Source Types
2929
* **"":** specifies that credentials should be detected. Application Default Credentials will be used if avaliable. A read-only client will be used otherwise.

gcs/config/config.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ var ErrWrongLengthEncryptionKey = errors.New("encryption_key not 32 bytes")
8787
// ErrNonPositiveHTTPRequestTimeout is returned when http_request_timeout is <= 0.
8888
var ErrNonPositiveHTTPRequestTimeout = errors.New("http_request_timeout must be greater than 0")
8989

90-
const defaultHTTPRequestTimeout = 60 * time.Second
91-
9290
// NewFromReader returns the new gcscli configuration struct from the
9391
// contents of the reader.
9492
//
@@ -131,7 +129,7 @@ func NewFromReader(reader io.Reader) (GCSCli, error) {
131129

132130
func (c *GCSCli) HTTPRequestTimeoutValue() (time.Duration, error) {
133131
if c.HTTPRequestTimeout == "" {
134-
return defaultHTTPRequestTimeout, nil
132+
return 0, nil
135133
}
136134

137135
if c.HTTPRequestTimeout == "0" {

gcs/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ var _ = Describe("BlobstoreClient configuration", func() {
187187
dummyJSONBytes := []byte(`{"bucket_name": "some-bucket"}`)
188188
dummyJSONReader := bytes.NewReader(dummyJSONBytes)
189189

190-
It("uses the default timeout", func() {
190+
It("leaves timeout unset", func() {
191191
c, err := NewFromReader(dummyJSONReader)
192192
Expect(err).To(BeNil())
193193
Expect(c.HTTPRequestTimeout).To(BeEmpty())
194194
requestTimeoutValue, err := c.HTTPRequestTimeoutValue()
195195
Expect(err).To(BeNil())
196-
Expect(requestTimeoutValue.Seconds()).To(Equal(60.0))
196+
Expect(requestTimeoutValue).To(BeZero())
197197
})
198198
})
199199

s3/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The S3 client requires a JSON configuration file with the following structure:
2121
"port": <int> (optional),
2222
"ssl_verify_peer": <bool> (optional - default: true),
2323
"use_ssl": <bool> (optional - default: true),
24-
"http_request_timeout": "<string duration> (default: '60s')",
24+
"http_request_timeout": "<string duration> (optional)",
2525
"signature_version": "<string> (optional)",
2626
"server_side_encryption": "<string> (optional)",
2727
"sse_kms_key_id": "<string> (optional)",
@@ -38,7 +38,7 @@ The S3 client requires a JSON configuration file with the following structure:
3838
}
3939
```
4040

41-
Set `http_request_timeout` to `"0"` to disable the HTTP client timeout explicitly.
41+
If `http_request_timeout` is omitted (or set to `"0s"`), the HTTP client timeout is left unset.
4242

4343
**Usage examples:**
4444
```shell

s3/config/config.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ type S3Cli struct {
5151
}
5252

5353
const (
54-
defaultHTTPRequestTimeout = 60 * time.Second
55-
5654
// multipartCopyMinPartSize is the AWS minimum part size for multipart operations.
5755
// Other providers may have different limits - users should consult their provider's documentation.
5856
multipartCopyMinPartSize = 5 * 1024 * 1024 // 5MB - AWS minimum part size
@@ -267,7 +265,7 @@ func (c *S3Cli) ShouldDisableUploaderRequestChecksumCalculation() bool {
267265

268266
func (c *S3Cli) HTTPRequestTimeoutValue() (time.Duration, error) {
269267
if c.HTTPRequestTimeout == "" {
270-
return defaultHTTPRequestTimeout, nil
268+
return 0, nil
271269
}
272270

273271
if _, err := strconv.ParseFloat(c.HTTPRequestTimeout, 64); err == nil {

s3/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ var _ = Describe("BlobstoreClient configuration", func() {
397397
})
398398

399399
Describe("http_request_timeout", func() {
400-
It("defaults to 60 seconds when not set", func() {
400+
It("leaves timeout unset when not set", func() {
401401
dummyJSONBytes := []byte(`{"access_key_id":"id","secret_access_key":"key","bucket_name":"some-bucket"}`)
402402
dummyJSONReader := bytes.NewReader(dummyJSONBytes)
403403

@@ -406,7 +406,7 @@ var _ = Describe("BlobstoreClient configuration", func() {
406406
Expect(c.HTTPRequestTimeout).To(BeEmpty())
407407
timeout, err := c.HTTPRequestTimeoutValue()
408408
Expect(err).ToNot(HaveOccurred())
409-
Expect(timeout.Seconds()).To(Equal(60.0))
409+
Expect(timeout).To(BeZero())
410410
})
411411

412412
It("parses a valid duration", func() {

0 commit comments

Comments
 (0)