-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP等所有语言][Darabonba 2.0]rebuild retry policy && support retry for throttling e… #145
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #145 +/- ##
=======================================
Coverage 53.84% 53.84%
=======================================
Files 1 1
Lines 455 455
Branches 94 94
=======================================
Hits 245 245
Misses 150 150
Partials 60 60 ☔ View full report in Codecov by Sentry. |
accessDeniedDetail = defaultAny(err.AccessDeniedDetail, err.accessDeniedDetail), | ||
}; | ||
var code = defaultAny(err.Code, err.code); | ||
if (Util.equalString(`${code}`, 'Throttling') || Util.equalString(`${code}`, 'Throttling.User') || Util.equalString(`${code}`, 'Throttling.Api')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以直接用 == 来判断字符串相等了
retryAfter = OpenApiUtil.getThrottlingTimeLeft(__response.headers), | ||
requestId = `${requestId}`, | ||
}; | ||
} else if (Util.is4xx(__response.statusCode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里也可以用 statusCodeSample >= 400 && statusCodeSample < 500判断
accessDeniedDetail = defaultAny(err.AccessDeniedDetail, err.accessDeniedDetail), | ||
}; | ||
var code = defaultAny(err.Code, err.code); | ||
if (Util.equalString(`${code}`, 'Throttling') || Util.equalString(`${code}`, 'Throttling.User') || Util.equalString(`${code}`, 'Throttling.Api')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
retryAfter = OpenApiUtil.getThrottlingTimeLeft(__response.headers), | ||
requestId = `${requestId}`, | ||
}; | ||
} else if (Util.is4xx(__response.statusCode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
description = `${defaultAny(err.Description, err.description)}`, | ||
requestId = `${requestId}`, | ||
}; | ||
} | ||
} | ||
if (Util.equalString(bodyType, 'binary')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有这些判断都改一下
@@ -542,14 +593,35 @@ api doROARequestWithForm(action: string, version: string, protocol: string, meth | |||
if (Util.is4xx(__response.statusCode) || Util.is5xx(__response.statusCode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改一下
}; | ||
var requestId = defaultAny(err.RequestId, err.requestId); | ||
var code = defaultAny(err.Code, err.code); | ||
if (Util.equalString(`${code}`, 'Throttling') || Util.equalString(`${code}`, 'Throttling.User') || Util.equalString(`${code}`, 'Throttling.Api')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
retryAfter = OpenApiUtil.getThrottlingTimeLeft(__response.headers), | ||
requestId = `${requestId}`, | ||
}; | ||
} else if (Util.is4xx(__response.statusCode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
accessDeniedDetail = defaultAny(err.AccessDeniedDetail, err.accessDeniedDetail), | ||
}; | ||
var requestId = defaultAny(err.RequestId, err.requestId); | ||
var code = defaultAny(err.Code, err.code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
…rror