fix: parse the response body message to determine retry backoff#249
fix: parse the response body message to determine retry backoff#249nolanmar511 merged 3 commits intogoogleapis:masterfrom
Conversation
| 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.
| // 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 |
aalexand
left a comment
There was a problem hiding this comment.
Thank you, I think it's almost done, just couple comments.
| // 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.
| // 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
| */ | ||
| 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.
| GTEST_VERSION="${GTEST_MIN_VERSION}"]) | ||
|
|
||
| # TODO(chandlerc@google.com) Check the types, structures, and other compiler | ||
| # (chandlerc@google.com) 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.
| } | ||
|
|
||
|
|
||
| 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.