From a1d9fe40045fd347d5713d1247ff1c1187f3ed4e Mon Sep 17 00:00:00 2001 From: Helio Frota <00hf11@gmail.com> Date: Sun, 25 Mar 2018 09:12:05 -0300 Subject: [PATCH] chore(source): typos and wrong args number on fallback function usage --- config/webpack.config.js | 6 +++--- lib/circuit.js | 10 +++++----- lib/hystrix-formatter.js | 2 +- lib/hystrix-stats.js | 2 +- lib/status.js | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index ff0da749..ffd356ac 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -3,14 +3,14 @@ const MinifyPlugin = require('babel-minify-webpack-plugin'); module.exports = { entry: { main: [ - './index.js' + './index.js' ] }, - mode: "production", + mode: 'production', output: { filename: 'opossum.js' }, plugins: [ new MinifyPlugin() ] -} \ No newline at end of file +}; diff --git a/lib/circuit.js b/lib/circuit.js index eb7ab817..e534fb9a 100644 --- a/lib/circuit.js +++ b/lib/circuit.js @@ -27,7 +27,7 @@ Please use options.errorThresholdPercentage`; * @extends EventEmitter * @param action {Function} The action to fire for this {@link CircuitBreaker} * @param options {Object} Options for the {@link CircuitBreaker}. - * There are **no default options** when you use the contructor directly. You + * There are **no default options** when you use the constructor directly. You * must supply values for each of these. * @param options.timeout {Number} The time in milliseconds that action should * be allowed to execute before timing out. @@ -305,7 +305,7 @@ class CircuitBreaker extends EventEmitter { */ this.emit('reject', new Error('Breaker is open')); - return fallback(this, 'Breaker is open', args, 0) || + return fallback(this, 'Breaker is open', args) || Promise.reject(new Error('Breaker is open')); } this[PENDING_CLOSE] = false; @@ -394,7 +394,7 @@ class CircuitBreaker extends EventEmitter { * `options.errorThresholdPercentage` in the constructor. For example, if the * health check function provided here always returns a resolved promise, the * circuit can still trip and open if there are failures exceeding the - * configured threshold. The health check function is excecuted within the + * configured threshold. The health check function is executed within the * circuit breaker's execution context, so `this` within the function is the * circuit breaker itself. * @@ -438,7 +438,7 @@ class CircuitBreaker extends EventEmitter { /** * Enables this circuit. If the circuit is the disabled - * state, it will be reenabled. If not, this is essentially + * state, it will be re-enabled. If not, this is essentially * a noop. */ enable () { @@ -457,7 +457,7 @@ class CircuitBreaker extends EventEmitter { function handleError (error, circuit, timeout, args, latency, resolve, reject) { clearTimeout(timeout); fail(circuit, error, args, latency); - const fb = fallback(circuit, error, args, latency); + const fb = fallback(circuit, error, args); if (fb) resolve(fb); else reject(error); } diff --git a/lib/hystrix-formatter.js b/lib/hystrix-formatter.js index 0ccf8ec9..64b5d544 100644 --- a/lib/hystrix-formatter.js +++ b/lib/hystrix-formatter.js @@ -35,7 +35,7 @@ function hystrixFormatter (stats) { rollingCountTimeout: stats.timeouts, currentConcurrentExecutionCount: 0, rollingMaxConcurrentExecutionCount: 0, - // TODO: caluclate these latency values + // TODO: calculate these latency values latencyExecute_mean: stats.latencyMean || 0, latencyExecute: percentiles(stats), // Whats the difference between execute and total? diff --git a/lib/hystrix-stats.js b/lib/hystrix-stats.js index b8ca1aee..977d6616 100644 --- a/lib/hystrix-stats.js +++ b/lib/hystrix-stats.js @@ -11,7 +11,7 @@ const hystrixStream = new Transform({ } }); -// TODO: This number is somewhat arbitrary. Howver, we need to allow +// TODO: This number is somewhat arbitrary. However, we need to allow // a potentially large number of listeners on this transform stream // because all circuits are connected to it. In an application with // a large number of circuits (or tests using circuits), if left to diff --git a/lib/status.js b/lib/status.js index 98812f65..89417553 100644 --- a/lib/status.js +++ b/lib/status.js @@ -44,7 +44,7 @@ const EventEmitter = require('events').EventEmitter; */ class Status extends EventEmitter { /** - * Emitted at each timeslice. Listeners for this + * Emitted at each time-slice. Listeners for this * event will receive a cumulative snapshot of the current status window. * @see Status#stats * @event Status#snapshot @@ -102,7 +102,7 @@ class Status extends EventEmitter { }, bucket()); if (this.rollingPercentilesEnabled) { - // Sort the latencyTimess + // Sort the latencyTimes totals.latencyTimes.sort((a, b) => a - b); // Get the mean latency