An open API service indexing awesome lists of open source software.

https://github.com/scality/breakbeat


https://github.com/scality/breakbeat

artesca zenko

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

          

# breakbeat

![Breakbeat](doc/breakbeat.png)

## About

Rule based stop and go.

## Examples

```typescript
const { CircuitBreaker, BreakerState } = require('breakbeat');
const conf = {
probes: [],
nominalEvaluateIntervalMs: 30000,
stabilizeAfterNSuccesses: 2,
};
const b = new CircuitBreaker(conf);
b.start();

const i = setInterval(() => {
if (b.state === BreakerState.Nominal) {
console.log('all good, proceeding');
} else {
console.log('issue detected, delaying work');
}
}, 5000);

process.on('beforeExit', (code) => {
clearInterval(i);
b.stop();
});
```