Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
circuit_breaker_config.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
12#pragma once
13
14#include <chrono>
15#include <cstddef>
16
18
32 std::size_t failure_threshold = 5;
33
38 std::size_t success_threshold = 2;
39
45 std::chrono::milliseconds failure_window = std::chrono::seconds(60);
46
51 std::chrono::milliseconds timeout = std::chrono::seconds(30);
52
57 std::size_t half_open_max_requests = 3;
58};
59
60} // namespace kcenon::common::resilience
Thread-safe sliding window for failure tracking.
Configuration parameters for circuit breaker.
std::chrono::milliseconds timeout
Timeout before transitioning from OPEN to HALF_OPEN. Default: 30 seconds.
std::size_t half_open_max_requests
Maximum number of requests allowed in HALF_OPEN state for testing. Default: 3 requests.
std::size_t failure_threshold
Number of failures required to trip the circuit (CLOSED -> OPEN). Default: 5 failures.
std::size_t success_threshold
Number of successful requests required to close the circuit (HALF_OPEN -> CLOSED)....