将大文件上传到Google Cloud Bucking失败

发布于 2025-02-13 20:45:26 字数 1091 浏览 2 评论 0原文

我正在将一个大文件从本地系统或远程_URL上传到Google Bucket。但是,每次我都会遇到以下错误。

/usr/local/lib/ruby/3.0.0/openssl/buffering.rb:345:iin“ syswrite':eccution

' local/lib/ruby/3.0.0/openssl/buffering.rb:345:在“ syswrite”中:执行已过期(HTTPCLIENT :: SENDTIMEOUTERROR)

我正在使用CarrierWave Initializer来定义我的Google服务帐户的配置及其详细信息。请建议如果我缺少任何配置,或者我添加以增加超时或重试。

我的载波初始化器:

begin
  CarrierWave.configure do |config|
    config.fog_provider = 'fog/google'
    config.fog_credentials = {
      provider: 'Google',
      google_project: '{project name}',
      #google_json_key_string: Rails.application.secrets.google_cloud_storage_credential_content
      google_json_key_location: '{My json key-file location}'
    }
    config.fog_attributes = {
      expires: 600000,
      open_timeout_sec: 600000,
      send_timeout_sec: 600000,
      read_timeout_sec: 600000,
      fog_authenticated_url_expiration: 600000

    }
    config.fog_authenticated_url_expiration = 600000
    config.fog_directory = 'test-bucket'
  end
  #


rescue => error
  puts error.message
end

I am uploading a large file from my local system or an remote_url to google bucket. However everytime I am getting the below error.

/usr/local/lib/ruby/3.0.0/openssl/buffering.rb:345:in `syswrite': execution expired (Google::Apis::TransmissionError)

/usr/local/lib/ruby/3.0.0/openssl/buffering.rb:345:in `syswrite': execution expired (HTTPClient::SendTimeoutError)

I am using carrierwave initializer to define configuration of my google service account and its details. Please suggest if there is any configuration I am missing or if I add to increase the timeout or retries.

My Carrierwave initializer:

begin
  CarrierWave.configure do |config|
    config.fog_provider = 'fog/google'
    config.fog_credentials = {
      provider: 'Google',
      google_project: '{project name}',
      #google_json_key_string: Rails.application.secrets.google_cloud_storage_credential_content
      google_json_key_location: '{My json key-file location}'
    }
    config.fog_attributes = {
      expires: 600000,
      open_timeout_sec: 600000,
      send_timeout_sec: 600000,
      read_timeout_sec: 600000,
      fog_authenticated_url_expiration: 600000

    }
    config.fog_authenticated_url_expiration = 600000
    config.fog_directory = 'test-bucket'
  end
  #


rescue => error
  puts error.message
end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2025-02-20 20:45:26

这可能与连接和初始化以及实际使用的时间之间的时间有关。添加:持久:false to fog_credentials应该使其为每个请求创建一个新连接。这有点少一些,但至少应该始终如一地工作,与您目前似乎正在跑步的情况不同。

This might have to do with the duration of time between when the connection and initialized and when it actually gets used. Adding: persistent: false to the fog_credentials should make it create a new connection for each request. This is a bit less performant, but it should at least work consistently, unlike what you appear to be running into presently.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文