Skip to content
Browse files

Merge branch 'master' into keepalive

  • Loading branch information...
2 parents 20fa515 + 720a9ee commit 58a28baafe17a8df32d85262b379f23227b767ea @dannycoates committed
Showing with 4 additions and 1 deletion.
  1. +3 −0 lib/pool.js
  2. +1 −1 lib/request_set.js
View
3 lib/pool.js
@@ -10,10 +10,12 @@ module.exports = function (inherits, EventEmitter, Endpoint, RequestSet) {
// {
// maxPending: number of pending requests allowed (1000)
// ping: ping path (default = no ping checks)
+ // pingTimeout: number (milliseconds) default 2000
// retryFilter: function (response) { return true to reject response and retry }
// retryDelay: number (milliseconds) default 20
// keepAlive: use an alternate Agent that does keep-alive properly (boolean) default false
// name: string (optional)
+ // maxRetries: number (default = 5)
// }
function Pool(http, nodes, options) {
options = options || {}
@@ -24,6 +26,7 @@ module.exports = function (inherits, EventEmitter, Endpoint, RequestSet) {
options.retryFilter = options.retryFilter || options.retry_filter
options.retryDelay = options.retryDelay || options.retry_delay
options.ping = options.ping || options.path
+ options.maxRetries = options.maxRetries === 0 ? 0 : options.maxRetries || 5
if (!options.retryDelay && options.retryDelay !== 0) {
options.retryDelay = 20
View
2 lib/request_set.js
@@ -34,7 +34,7 @@ function attemptsFu(options, pool) {
if (options.data instanceof Stream) {
return 1
}
- return options.attempts || Math.min(5, Math.max(pool.length, 2))
+ return options.attempts || Math.min(pool.options.maxRetries, Math.max(pool.length, 2))
}
function exponentialBackoff(attempt, delay) {

0 comments on commit 58a28ba

Please sign in to comment.
Something went wrong with that request. Please try again.