Skip to content

Commit

Permalink
chore: a little more eslint for good measure
Browse files Browse the repository at this point in the history
  • Loading branch information
lance committed Apr 29, 2019
1 parent 4967736 commit f452bd0
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 69 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Issue contributions

### Did you find a bug ?
### Did you find a bug?

Open a [new issue](https://github.com/nodeshift/opossum/issues/new).
Be sure to include a title and clear description, with as much relevant information
Expand Down
72 changes: 33 additions & 39 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.maxFailures</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>The number of times the circuit can fail before
opening. Default 10.
<td class='break-word'><span>The number of times the circuit can fail
before opening. Default 10.
</span></td>
</tr>

Expand All @@ -753,8 +753,8 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.resetTimeout</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>The time in milliseconds to wait before setting
the breaker to
<td class='break-word'><span>The time in milliseconds to wait before
setting the breaker to
<code>halfOpen</code>
state, and trying the action again.
</span></td>
Expand All @@ -765,9 +765,9 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.rollingCountTimeout</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>Sets the duration of the statistical rolling
window, in milliseconds. This is how long Opossum keeps metrics for the circuit
breaker to use and for publishing. Default: 10000
<td class='break-word'><span>Sets the duration of the
statistical rolling window, in milliseconds. This is how long Opossum keeps
metrics for the circuit breaker to use and for publishing. Default: 10000
</span></td>
</tr>

Expand All @@ -776,10 +776,11 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.rollingCountBuckets</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>Sets the number of buckets the rolling
statistical window is divided into. So, if options.rollingCountTimeout is
10000, and options.rollingCountBuckets is 10, then the statistical window will
be 1000 1 second snapshots in the statistical window. Default: 10
<td class='break-word'><span>Sets the number of buckets the
rolling statistical window is divided into. So, if
options.rollingCountTimeout is 10000, and options.rollingCountBuckets is 10,
then the statistical window will be 1000 1 second snapshots in the
statistical window. Default: 10
</span></td>
</tr>

Expand All @@ -797,10 +798,10 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.rollingPercentilesEnabled</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
</td>
<td class='break-word'><span>This property indicates whether
execution latencies should be tracked and calculated as percentiles. If they
are disabled, all summary statistics (mean, percentiles) are returned as -1.
Default: false
<td class='break-word'><span>This property indicates
whether execution latencies should be tracked and calculated as percentiles.
If they are disabled, all summary statistics (mean, percentiles) are
returned as -1. Default: false
</span></td>
</tr>

Expand All @@ -809,11 +810,12 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.capacity</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>the number of concurrent requests allowed. If the number
currently executing function calls is equal to options.capacity, further calls
to
<td class='break-word'><span>the number of concurrent requests allowed.
If the number currently executing function calls is equal to
options.capacity, further calls to
<code>fire()</code>
are rejected until at least one of the current requests completes.
are rejected until at least one
of the current requests completes.
</span></td>
</tr>

Expand All @@ -822,8 +824,8 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.errorThresholdPercentage</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>the error percentage at which to open the
circuit and start short-circuiting requests to fallback.
<td class='break-word'><span>the error percentage at
which to open the circuit and start short-circuiting requests to fallback.
</span></td>
</tr>

Expand All @@ -832,7 +834,8 @@ <h3 class='fl m0' id='factory'>
<tr>
<td class='break-word'><span class='code bold'>options.enabled</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
</td>
<td class='break-word'><span>whether this circuit is enabled upon construction. Default: true
<td class='break-word'><span>whether this circuit is enabled upon
construction. Default: true
</span></td>
</tr>

Expand All @@ -846,11 +849,11 @@ <h3 class='fl m0' id='factory'>

<code>rollingCountDuration</code>
property). Default: false
allow before enabling the circuit. This can help in situations where no matter
what your
allow before enabling the circuit. This can help in situations where no
matter what your
<code>errorThresholdPercentage</code>
is, if the first execution times out or
fails, the circuit immediately opens. Default: 0
is, if the first execution
times out or fails, the circuit immediately opens. Default: 0
</span></td>
</tr>

Expand Down Expand Up @@ -940,7 +943,7 @@ <h3 class='fl m0' id='factorypromisify'>
creates an action that returns a promise which resolves when the function's
callback is executed.</p>

<div class='pre p1 fill-light mt0'>factory.promisify(action: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a></div>
<div class='pre p1 fill-light mt0'>factory.promisify(action: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>)</div>



Expand Down Expand Up @@ -970,16 +973,6 @@ <h3 class='fl m0' id='factorypromisify'>




<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>:
The
<code>action</code>
wrapped in a promise API.







Expand Down Expand Up @@ -3252,7 +3245,7 @@ <h3 class='fl m0' id='status'>
<tr>
<td class='break-word'><span class='code bold'>options.rollingCountBuckets</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>
</td>
<td class='break-word'><span>the number of buckets in the window
<td class='break-word'><span>number of buckets in the window
</span></td>
</tr>

Expand All @@ -3270,7 +3263,8 @@ <h3 class='fl m0' id='status'>
<tr>
<td class='break-word'><span class='code bold'>options.rollingPercentilesEnabled</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code>
</td>
<td class='break-word'><span>whether to calculate percentiles
<td class='break-word'><span>whether to calculate
percentiles
</span></td>
</tr>

Expand Down
58 changes: 30 additions & 28 deletions docs/opossum.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,37 @@ Creates a [CircuitBreaker][6] instance capable of executing `action`.
- `options` **[Object][57]** Options for the [CircuitBreaker][6]
- `options.timeout` **[Number][58]** The time in milliseconds that action should
be allowed to execute before timing out. Default 10000 (10 seconds)
- `options.maxFailures` **[Number][58]** The number of times the circuit can fail before
opening. Default 10.
- `options.resetTimeout` **[Number][58]** The time in milliseconds to wait before setting
the breaker to `halfOpen` state, and trying the action again.
- `options.rollingCountTimeout` **[Number][58]** Sets the duration of the statistical rolling
window, in milliseconds. This is how long Opossum keeps metrics for the circuit
breaker to use and for publishing. Default: 10000
- `options.rollingCountBuckets` **[Number][58]** Sets the number of buckets the rolling
statistical window is divided into. So, if options.rollingCountTimeout is
10000, and options.rollingCountBuckets is 10, then the statistical window will
be 1000 1 second snapshots in the statistical window. Default: 10
- `options.maxFailures` **[Number][58]** The number of times the circuit can fail
before opening. Default 10.
- `options.resetTimeout` **[Number][58]** The time in milliseconds to wait before
setting the breaker to `halfOpen` state, and trying the action again.
- `options.rollingCountTimeout` **[Number][58]** Sets the duration of the
statistical rolling window, in milliseconds. This is how long Opossum keeps
metrics for the circuit breaker to use and for publishing. Default: 10000
- `options.rollingCountBuckets` **[Number][58]** Sets the number of buckets the
rolling statistical window is divided into. So, if
options.rollingCountTimeout is 10000, and options.rollingCountBuckets is 10,
then the statistical window will be 1000 1 second snapshots in the
statistical window. Default: 10
- `options.name` **[String][59]** the circuit name to use when reporting stats
- `options.rollingPercentilesEnabled` **[boolean][60]** This property indicates whether
execution latencies should be tracked and calculated as percentiles. If they
are disabled, all summary statistics (mean, percentiles) are returned as -1.
Default: false
- `options.capacity` **[Number][58]** the number of concurrent requests allowed. If the number
currently executing function calls is equal to options.capacity, further calls
to `fire()` are rejected until at least one of the current requests completes.
- `options.errorThresholdPercentage` **[Number][58]** the error percentage at which to open the
circuit and start short-circuiting requests to fallback.
- `options.enabled` **[boolean][60]** whether this circuit is enabled upon construction. Default: true
- `options.rollingPercentilesEnabled` **[boolean][60]** This property indicates
whether execution latencies should be tracked and calculated as percentiles.
If they are disabled, all summary statistics (mean, percentiles) are
returned as -1. Default: false
- `options.capacity` **[Number][58]** the number of concurrent requests allowed.
If the number currently executing function calls is equal to
options.capacity, further calls to `fire()` are rejected until at least one
of the current requests completes.
- `options.errorThresholdPercentage` **[Number][58]** the error percentage at
which to open the circuit and start short-circuiting requests to fallback.
- `options.enabled` **[boolean][60]** whether this circuit is enabled upon
construction. Default: true
- `options.allowWarmUp` **[boolean][60]** determines whether to allow failures
without opening the circuit during a brief warmup period (this is the
`rollingCountDuration` property). Default: false
allow before enabling the circuit. This can help in situations where no matter
what your `errorThresholdPercentage` is, if the first execution times out or
fails, the circuit immediately opens. Default: 0
allow before enabling the circuit. This can help in situations where no
matter what your `errorThresholdPercentage` is, if the first execution
times out or fails, the circuit immediately opens. Default: 0
- `options.volumeThreshold` **[Number][58]** the minimum number of requests within
the rolling statistical window that must exist before the circuit breaker
can open. This is similar to `options.allowWarmUp` in that no matter how many
Expand Down Expand Up @@ -128,8 +131,6 @@ const fs = require('fs');
const breaker = circuitBreaker(readFilePromised);
```

Returns **[Function][56]** The `action` wrapped in a promise API.

## CircuitBreaker

**Extends EventEmitter**
Expand Down Expand Up @@ -454,9 +455,10 @@ is determined by dividing the `rollingCountTimeout` by
### Parameters

- `options` **[Object][57]** for the status window
- `options.rollingCountBuckets` **[Number][58]** the number of buckets in the window
- `options.rollingCountBuckets` **[Number][58]** number of buckets in the window
- `options.rollingCountTimeout` **[Number][58]** the duration of the window
- `options.rollingPercentilesEnabled` **[Boolean][60]** whether to calculate percentiles
- `options.rollingPercentilesEnabled` **[Boolean][60]** whether to calculate
percentiles

### Examples

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ci": "npm run build && npm run test && npm run test:headless && npm run coverage",
"prerelease": "npm run test:ci",
"release": "standard-version -s",
"lint": "standardx test/*.js index.js lib/*.js",
"lint": "standardx test/*.js index.js lib/*.js test/*/*.js",
"clean": "rm -rf node_modules dist/*.js test/browser/webpack-test.js"
},
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions test/browser/browser-tap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint no-console: "off" */
/* eslint-env browser */
// for browser output
const log = console.log;

Expand Down

0 comments on commit f452bd0

Please sign in to comment.