@bbc/http-transport-circuit-breaker

Basic circuit breaker based on Levee.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@bbc/http-transport-circuit-breaker
231.2.04 years ago4 years agoMinified + gzip package size for @bbc/http-transport-circuit-breaker in KB

Readme

http-transport-circuit-breaker
Basic circuit breaker based on Levee.

Installation

npm install --save @bbc/http-transport-circuit-breaker

Usage

const Levee = require('levee');
const request = require('request');

const options = {
    maxFailures: 5,
    timeout: 60000,
    resetTimeout: 30000
};

const circuit = Levee.createBreaker(request.get, options);
circuit.run('http://www.google.com', (err, req, payload) => {
    console.log(err || payload);
});

Test

npm test

To generate a test coverage report:
npm run coverage