将大文件上传到Google Cloud Bucking失败
我正在将一个大文件从本地系统或远程_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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能与连接和初始化以及实际使用的时间之间的时间有关。添加:
持久:false
tofog_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 thefog_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.