-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retry on RDSDataService Communications link failure (#2931)
* Retry on RDSDataService Communications link failure
- Loading branch information
1 parent
3f6547e
commit bf1ebe0
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "feature", | ||
"category": "RDSDataService", | ||
"description": "Retry on Serverless Aurora \"Communications link failure\"" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var AWS = require('../core'); | ||
|
||
AWS.util.update(AWS.RDSDataService.prototype, { | ||
/** | ||
* @return [Boolean] whether the error can be retried | ||
* @api private | ||
*/ | ||
retryableError: function retryableError(error) { | ||
if (error.code === 'BadRequestException' && | ||
error.message && | ||
error.message.match(/^Communications link failure/) && | ||
error.statusCode === 400) { | ||
return true; | ||
} else { | ||
var _super = AWS.Service.prototype.retryableError; | ||
return _super.call(this, error); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var AWS, helpers; | ||
|
||
helpers = require('../helpers'); | ||
|
||
AWS = helpers.AWS; | ||
|
||
describe('AWS.RDSDataService', function() { | ||
var service; | ||
beforeEach(function() { | ||
service = new AWS.RDSDataService(); | ||
}); | ||
return describe('retryableError', function() { | ||
it('retryableError returns true for Communications link failure errors', function() { | ||
var err; | ||
err = { | ||
message: 'Communications link failure\n' + | ||
'\n' + | ||
'The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.', | ||
code: 'BadRequestException', | ||
statusCode: 400 | ||
}; | ||
return expect(service.retryableError(err)).to.be['true']; | ||
}); | ||
return it('retryableError returns false for other 400 errors', function() { | ||
var err; | ||
err = { | ||
code: 'SomeErrorCode', | ||
statusCode: 400 | ||
}; | ||
return expect(service.retryableError(err)).to.be['false']; | ||
}); | ||
}); | ||
}); |