How to override HTTP timeouts per-request in AWS S3 SDK? #3320
-
|
Hi! In our application, we have low HTTP timeouts for S3 queries because in some code paths, we expect the operations to be fast and can't afford to let them block processing. However, we also have code paths were it is safe for us to wait for much longer, and we do have operations that we know can be slow. Therefore I'm looking into how to override the HTTP timeouts for these specific requests. The description of
Is it possible to override the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi! Based on my light investigation, I observed the following: [1] pry(Aws)> client = Aws::S3::Client.new
=> #<Aws::S3::Client>
[2] pry(Aws)> client.config.http_open_timeout
=> 15
[3] pry(Aws)> client.put_object({bucket: 'some-bucket', key: "foo", body: 'bar'})
Session open timeout is: 15
[Aws::S3::Client 200 0.200642 0 retries] put_object(bucket:"some-bucket",key:"foo",body:"bar",checksum_algorithm:"CRC32")
=> #<struct Aws::S3::Types::PutObjectOutput ...
[4] pry(Aws)> client.config.http_open_timeout=10
[4] pry(Aws)> client.put_object({bucket: 'some-bucket', key: "foo", body: 'bar'})
Session open timeout is: 10
[Aws::S3::Client 200 0.165705 0 retries] put_object(bucket:"some-bucket",key:"foo",body:"bar",checksum_algorithm:"CRC32")
=> #<struct Aws::S3::Types::PutObjectOutput .. This completely overrides the client config, so you'd need to create a new client instance. However, this could be a feature that we could consider adding in the next MV. |
Beta Was this translation helpful? Give feedback.
Hi! Based on my light investigation, I observed the following: