(fn, args, callback)
| 10 | |
| 11 | // Wraps a function to be called in a backoff loop. |
| 12 | function FunctionCall(fn, args, callback) { |
| 13 | events.EventEmitter.call(this); |
| 14 | |
| 15 | precond.checkIsFunction(fn, 'Expected fn to be a function.'); |
| 16 | precond.checkIsArray(args, 'Expected args to be an array.'); |
| 17 | precond.checkIsFunction(callback, 'Expected callback to be a function.'); |
| 18 | |
| 19 | this.function_ = fn; |
| 20 | this.arguments_ = args; |
| 21 | this.callback_ = callback; |
| 22 | this.lastResult_ = []; |
| 23 | this.numRetries_ = 0; |
| 24 | |
| 25 | this.backoff_ = null; |
| 26 | this.strategy_ = null; |
| 27 | this.failAfter_ = -1; |
| 28 | this.retryPredicate_ = FunctionCall.DEFAULT_RETRY_PREDICATE_; |
| 29 | |
| 30 | this.state_ = FunctionCall.State_.PENDING; |
| 31 | } |
| 32 | util.inherits(FunctionCall, events.EventEmitter); |
| 33 | |
| 34 | // States in which the call can be. |
nothing calls this directly
no outgoing calls
no test coverage detected