super-simple-circuit-breaker

0.1.2 • Public • Published

Super Simple circuit breaker

Super Simple circuit breaker

Installation

npm install super-simple-circuit-breaker

Usage


const SimpleCircuitBreaker = requere("simple-circuit-breaker')

// after 3 times failure, citcuit breaker open a circuit for 1000ms
const options = {
    retry: 3,
    halfopenTime: 1000
}
const authServerCB = new SimpleCircuitBreaker(options);
// res will be http response obj
const res = await authServerCB.run(callGoogle = async () => {
  return new Promise( (resolve, reject) => {
    http.get({
      host: "www.google.com"
    }, (res) => {
      return resolve(res)
    })
  })
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    2
  • 0.1.1
    1
  • 0.1.0
    1

Package Sidebar

Install

npm i super-simple-circuit-breaker

Weekly Downloads

4

Version

0.1.2

License

ISC

Unpacked Size

18.3 kB

Total Files

6

Last publish

Collaborators

  • chunghyup