-
Notifications
You must be signed in to change notification settings - Fork 35
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
fix: parse the response body message to determine retry backoff #249
Conversation
@@ -637,7 +637,9 @@ describe('Profiler', () => { | |||
.onCall(0) | |||
.callsArgWith(1, undefined, undefined, { | |||
statusCode: 409, | |||
body: {error: {details: [{retryDelay: '50s'}]}} | |||
body: { | |||
message: 'action throttled, backoff for 50s', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ts/src/profiler.ts
Outdated
// The response currently does not have field containing the retry duration. | ||
// As a work-around, response body's message is parsed to get the backoff | ||
// duration. | ||
// TODO: Remove this work-around and get the retry delay from |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #249 +/- ##
========================================
+ Coverage 89.94% 90% +0.05%
========================================
Files 6 6
Lines 388 390 +2
Branches 69 68 -1
========================================
+ Hits 349 351 +2
Misses 39 39
Continue to review full report at Codecov.
|
e48b9fc
to
c9ef41b
Compare
PTAL |
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.
Thank you, I think it's almost done, just couple comments.
ts/src/profiler.ts
Outdated
// The response currently does not have field containing the server-specified | ||
// backoff. As a workaround, response body's message is parsed to get the | ||
// backoff. | ||
// TODO: Remove this work-around and get the retry delay from |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ts/src/profiler.ts
Outdated
// The response currently does not have field containing the server-specified | ||
// backoff. As a workaround, response body's message is parsed to get the | ||
// backoff. | ||
// TODO: Remove this work-around and get the retry delay from |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
c9ef41b
to
d531663
Compare
d531663
to
15846f8
Compare
ts/src/profiler.ts
Outdated
*/ | ||
export function parseBackoffDuration(backoffStr: string): number|undefined { | ||
const found = backoffStr.match(BACKOFF_MSG_PAT); | ||
if (found && found.length >= 2 && typeof found[1] === 'string') { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -139,7 +139,7 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], | |||
GTEST_LIBS='$(top_builddir)/../googletest/lib/libgtest.la' | |||
GTEST_VERSION="${GTEST_MIN_VERSION}"]) | |||
|
|||
# TODO([email protected]) Check the types, structures, and other compiler | |||
# ([email protected]) Check the types, structures, and other compiler |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ts/src/profiler.ts
Outdated
} | ||
|
||
|
||
const BACKOFF_MSG_PATH = |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
cf6ca14
to
bb429ae
Compare
PTAL |
bb429ae
to
c5e047c
Compare
@nolanmar511 The CI test failed on node10? |
@nolanmar511 Please merge once node10 CI is passing. (assuming ofrobots@ doesn't have more comments) |
c5e047c
to
0d0cc16
Compare
This fixes #245.