提交 668558dd 编写于 作者: A Adam Lee 提交者: Adam Lee

gpcloud: sleep and retry if AWS returns "NoSuchKey" error

CI reported some read failures just after the write action, it's
probably because the write action is not flushed yet by AWS.

Sleep and retry if AWS returns "NoSuchKey" error. Update the workflow
but not the test cases because users might have the same issue.
上级 730d31d5
......@@ -13,6 +13,9 @@ class S3Exception {
virtual ~S3Exception() {
}
virtual string getCode() {
return "";
}
virtual string getMessage() {
return "";
}
......@@ -128,6 +131,10 @@ class S3LogicError : public S3Exception {
}
virtual ~S3LogicError() {
}
virtual string getCode() {
return awscode;
}
virtual string getMessage() {
return "AWS returns error " + awscode + " : " + message;
}
......
......@@ -31,13 +31,26 @@ S3InterfaceService::~S3InterfaceService() {
Response S3InterfaceService::getResponseWithRetries(const string &url, HTTPHeaders &headers,
uint64_t retries) {
string code;
string message;
uint64_t retry = retries;
while (retry--) {
try {
return this->restfulService->get(url, headers);
} catch (S3ConnectionError &e) {
} catch (S3Exception &e) {
if (e.getType() != "S3ConnectionError" || e.getType() != "S3LogicError") {
break;
}
code = e.getCode();
if (code == "NoSuchKey") {
sleep(1);
continue;
} else if (!code.empty()) {
break;
}
message = e.getMessage();
if (S3QueryIsAbortInProgress()) {
S3_DIE(S3QueryAbort, "Downloading is interrupted");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册