Those changes are not released yet.
- In the functional API, invoke the wrapped function callback on abort and emit
abortevent. This makes it possible to detect when abort is called.
- Add a method on the function API,
call.retryIf(predicate), which specifies a predicate used to determine whether a given error is retriable or not. The default behavior is unaffected, errors remain retriable by default.
- Add support for specifying the factor to use in the
FunctionCall.getLastResultto avoid storing intermediary results forever as this may lead to memory exhaustion when used in conjunction with an infinite number of backoffs.
FunctionCall.getNumRetrieswhich returns the number of times the wrapped function was retried.
- Add four new methods to
FunctionCallto query the state of the call.
- To match
FunctionCallno longer sets a default failAfter of 5, i.e. the maximum number of backoffs is now unbounded by default.
Backoff.backoffnow accepts an optional error argument that is re-emitted as the last argument of the
failevents. This provides some context to the listeners as to why a given backoff operation was attempted.
backoffevent emitted by the
FunctionCallclass now contains, as its last argument, the error that caused the backoff operation to be attempted. This provides some context to the listeners as to why a given backoff operation was attempted.
backoff.callno longer invokes the wrapped function on
nextTick. That way, the first attempt is not delayed until the end of the current event loop.
FunctionCall.backoffFactorya private member.
backoff.calland the associated
- Add a
- Remove deprecated
- Expose fibonacci and exponential strategies.
- Provide exponential and fibonacci backoffs.
- Use fibonnaci backoff.