root / HServer / 00.Server / 00.Program / node_modules / backo2 / Readme.md
이력 | 보기 | 이력해설 | 다운로드 (503 Bytes)
| 1 |
# backo |
|---|---|
| 2 |
|
| 3 |
Simple exponential backoff because the others seem to have weird abstractions. |
| 4 |
|
| 5 |
## Installation |
| 6 |
|
| 7 |
``` |
| 8 |
$ npm install backo |
| 9 |
``` |
| 10 |
|
| 11 |
## Options |
| 12 |
|
| 13 |
- `min` initial timeout in milliseconds [100] |
| 14 |
- `max` max timeout [10000] |
| 15 |
- `jitter` [0] |
| 16 |
- `factor` [2] |
| 17 |
|
| 18 |
## Example |
| 19 |
|
| 20 |
```js |
| 21 |
var Backoff = require('backo');
|
| 22 |
var backoff = new Backoff({ min: 100, max: 20000 });
|
| 23 |
|
| 24 |
setTimeout(function(){
|
| 25 |
something.reconnect(); |
| 26 |
}, backoff.duration()); |
| 27 |
|
| 28 |
// later when something works |
| 29 |
backoff.reset() |
| 30 |
``` |
| 31 |
|
| 32 |
# License |
| 33 |
|
| 34 |
MIT |