diff --git a/lib/circuit.js b/lib/circuit.js index a36f9278..f45f07c0 100644 --- a/lib/circuit.js +++ b/lib/circuit.js @@ -596,7 +596,7 @@ class CircuitBreaker extends EventEmitter { // If cache is enabled, check if we have a cached value if (this.options.cache) { - cacheKey = this.options.cacheGetKey.apply(this, rest); + cacheKey = this.options.cacheGetKey(...rest); const cached = this.options.cacheTransport.get(cacheKey); if (cached) { /** @@ -824,8 +824,8 @@ function fallback (circuit, err, args) { if (circuit[FALLBACK_FUNCTION]) { try { const result = - circuit[FALLBACK_FUNCTION] - .apply(circuit[FALLBACK_FUNCTION], [...args, err]); + circuit[FALLBACK_FUNCTION](...args, err); + /** * Emitted when the circuit breaker executes a fallback function * @event CircuitBreaker#fallback diff --git a/lib/status.js b/lib/status.js index 41165def..e3ba336a 100644 --- a/lib/status.js +++ b/lib/status.js @@ -106,7 +106,9 @@ class Status extends EventEmitter { }); if (this.rollingPercentilesEnabled) { - acc.latencyTimes.push.apply(acc.latencyTimes, val.latencyTimes || []); + if (val.latencyTimes) { + acc.latencyTimes = acc.latencyTimes.concat(val.latencyTimes); + } } return acc; }, bucket());