英文:
Where is the retrying logic in the Google Cloud Storage go client?
问题
一些关于Go客户端的Google云存储的文档表示:
该库支持向云存储读写大量数据,具有内部错误处理和重试功能,因此您不必编写自己的代码来完成这个任务。
然而,当使用下面的代码片段将对象PUT到云存储时,偶尔会返回503 Service Unavailable错误。
云存储请求重试的逻辑位于哪里?
conf, err := google.JWTConfigFromJSON([]byte(apiKey), storage.ScopeFullControl)
if err != nil {
panic(err)
}
ctx := cloud.NewContext(projectId, conf.Client(oauth2.NoContext))
writer := storage.NewWriter(self.ctx, Bucket, key)
_, err := writer.Write(data)
if err != nil {
return err
}
英文:
Some Google documentation for the go client for Cloud Storage says:
> This library supports reading and writing large amounts of data to Cloud Storage, with internal error handling and retries, so you don't have to write your own code to do this.
However, when using the below snippet of code which PUTs an object to Cloud Storage, a 503 Service Unavailable error gets returned to me occasionally.
Where is the logic for retrying Cloud Storage requests located?
conf, err := google.JWTConfigFromJSON([]byte(apiKey),storage.ScopeFullControl)
if err != nil {
panic(err)
}
ctx := cloud.NewContext(projectId, conf.Client(oauth2.NoContext))
writer := storage.NewWriter(self.ctx, Bucket, key)
_, err := writer.Write(data)
if err != nil {
return err
}
答案1
得分: 0
根据Glenn Lewis在GCloud问题(2月20日)中提到的内容:
> 我们正在google-api-go-client库中开发一个可恢复上传(ResumableMedia upload)功能,以便在传输过程中出现故障时可以从中断的地方重新开始。我希望这可以解决问题,但是由于还在进行设计讨论,所以无法告诉您何时准备好。
目前在源代码中没有关于ResumableMedia
的参考,所以文档可能是错误的。请注意,storage
包是实验性的。
英文:
As mentioned by Glenn Lewis on a GCloud issue (20 Feb):
> We are working on a ResumableMedia upload in the google-api-go-client
> library that will simply retry from where it left off in case
> something failed during transfer. I'm hoping that this should solve
> the problem, but I don't have a date for you as to when this will be
> ready because there are continuing design discussions.
Right now there is no reference to ResumableMedia
in the source code, so seems that the documentation is wrong. Note that the storage
package is experimental.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论