File tree 1 file changed +7
-7
lines changed 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
1
# Elastic Loop
2
2
[ ![ Build Status] ( https://travis-ci.org/grindcode/elastic-loop.svg?branch=master )] ( https://travis-ci.org/grindcode/elastic-loop ) [ ![ Dependency Status] ( https://david-dm.org/grindcode/elastic-loop.svg )] ( https://david-dm.org/grindcode/elastic-loop ) [ ![ devDependency Status] ( https://david-dm.org/grindcode/elastic-loop/dev-status.svg )] ( https://david-dm.org/grindcode/elastic-loop#info=devDependencies )
3
3
4
- Runs an interval with elastic timeout. Useful for loops supporting heavy load situations.
4
+ Runs an interval with variable timeout. Useful for loops adapting to heavy load or other kind of situations.
5
5
6
6
## Get Started
7
7
``` bash
@@ -21,22 +21,22 @@ Runs `function` in loop, mutating timeout depending on `stress`. Returns instanc
21
21
22
22
### Usage
23
23
``` javascript
24
- var loop = require (' elastic-loop' )
25
- var busy = require (' node-busy' )
24
+ const loop = require (' elastic-loop' )
25
+ const busy = require (' node-busy' )
26
26
27
- monitor = busy ()
27
+ const monitor = busy ()
28
28
29
29
// @cycle: current cycle fingerprint
30
- var run = function (cycle ) {
30
+ function run (cycle ) {
31
31
// → @cycle: { timeout: 1000, stress: 1 }
32
32
}
33
33
34
- var stress = function () {
34
+ function stress () {
35
35
// returns true if overloaded, false otherwise
36
36
return monitor .blocked
37
37
}
38
38
39
- var cycle = loop (run, stress)
39
+ const cycle = loop (run, stress)
40
40
41
41
// cycle.end()
42
42
You can’t perform that action at this time.
0 commit comments