Skip to content
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

fixes #202 by retrying on an UNKNOWN error code #212

Merged
merged 9 commits into from
Jun 6, 2018
Merged

Conversation

crwilcox
Copy link
Contributor

@crwilcox crwilcox commented Jun 6, 2018

Fixes #202

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 6, 2018
@ghost ghost assigned crwilcox Jun 6, 2018
@JustinBeckwith
Copy link
Contributor

A unit test for this would be lovely :)

@codecov
Copy link

codecov bot commented Jun 6, 2018

Codecov Report

Merging #212 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #212   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1385   1388    +3     
=====================================
+ Hits         1385   1388    +3
Impacted Files Coverage Δ
src/transaction.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e818203...cd70bfb. Read the comment docs.

@crwilcox
Copy link
Contributor Author

crwilcox commented Jun 6, 2018

@JustinBeckwith , sure I thought about duplicating the one we have for errcode 10 so easy to add :)

* @param {number} errCode - the error code
* @return {boolean}
*/
Transaction.prototype.isRetryableErrorCode_ = function(errCode) {

This comment was marked as spam.

*
* @param {error} err - The request error.
* @return {boolean}
*/
Transaction.prototype.shouldRetry_ = function(err) {
return (
err.code === ABORTED &&
this.isRetryableErrorCode_(err.code) &&

This comment was marked as spam.

@@ -725,7 +725,39 @@ describe('Transaction', function() {
fakeStream.emit('error', error);
});

it('should retry the transaction', function(done) {
it('should retry the transaction for UNKNOWN', function(done) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -403,7 +410,7 @@ Transaction.prototype.request = function(config, callback) {
);

this.session.request(config, function(err, resp) {
if (!self.runFn_ || !err || err.code !== ABORTED) {
if (!self.runFn_ || !err || !self.isRetryableErrorCode_(err.code)) {

This comment was marked as spam.

@crwilcox crwilcox dismissed stephenplusplus’s stale review June 6, 2018 22:56

Subject to review, but all comments were about expanding testing, which I have addressed.

@crwilcox crwilcox merged commit 9fa5686 into master Jun 6, 2018
@ghost ghost removed the cla: yes This human has signed the Contributor License Agreement. label Jun 6, 2018
@stephenplusplus stephenplusplus deleted the issue-202 branch June 20, 2018 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants