Skip to content

benjstephenson/circuit-breaker-ts

Repository files navigation

circuit-breaker-ts

Dependency free circuit breaker.

Given a thunk () => Promise<A>, allow a configurable number of errors to occur before any subsequent calls to the thunk are short-circuited for a set amount of time.

The error threshold, error message and back off time are configurable.

Useful for protecting calls to external services that may experience an outage.

A convenience function that returns a singleton is available so that an instance can be built at app startup and injected into services.

Inspired by a great blog post on circuit breakers in the functional world

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages