Resilient
|
Fail-fast when tasks are consistently failing. More...
#include <circuitbreaker.hpp>
Public Member Functions | |
Circuitbreaker (std::unique_ptr< ICircuitbreakerStrategy > &&strategy) | |
Construct a Circuitbreaker with the given strategy. | |
template<typename Callable , typename... Args> | |
return_type_t< Callable, Args... > | execute (Callable &&callable, Args &&...args) |
Execute the task if the Circuitbreaker is not open. More... | |
Fail-fast when tasks are consistently failing.
A missbehaving dependency might take a long time to respond. When many operations depend on it the slowdown can be propagated to the rest of the system.
The Circuitbreaker
uses an algorithm (implemented in the strategy) to determine when to stop contacting the dependency and just assume a failure.
This keeps limit the performance impact a dependency can cause to the whole system.
|
inline |
Execute the task if the Circuitbreaker
is not open.
callable | The task to execute |
args... | The arguments to the task |