什么是 AWS SDK 请求超时?

What is AWS SDK request timeout?

我正在使用 https://github.com/aws/aws-sdk-ruby 将视频文件上传到 S3。 服务器应用程序准备预签名 post 数据,前端向 AWS S3 发送 AJAX 请求。

我想知道在发生超时错误之前这个请求能持续多久。 实际上我担心文件大小和低带宽可能是长时间上传和应用程序崩溃的原因,所以我不想避免这种情况。

来自http://docs.aws.amazon.com/AWSRubySDK/latest/AWS.html#config-class_method

:http_idle_timeout (Integer) — default: 60 — The number of seconds a persistent connection is allowed to sit idle before it should no longer be used.

:http_open_timeout (Integer) — default: 15 — The number of seconds before the :http_handler should timeout while trying to open a new HTTP session.

:http_read_timeout (Integer) — default: 60 — The number of seconds before the :http_handler should timeout while waiting for a HTTP response.

您可以自由扩展 AWS.Config 的这些值。

顺便说一句,对于版本 2 的 SDK(这是你应该用于新开发的),没有用于设置这些的中央核心 API(就像以前版本中的 AWS.config)事情,相反,您需要在初始化客户端时为每个不同的 API 指定它。

例如,要为 S3 客户端设置 HTTP 超时,您可以像这样初始化它:

s3 = Aws::S3::Client.new http_read_timeout: 10