TsgcWSCircuitBreaker › Methods › ForceOpen
Manually moves the circuit for the given key into the Open state.
procedure ForceOpen(const aKey: string);
| Name | Type | Description |
|---|---|---|
aKey | const string | Circuit key to force Open — usually the hostname of the upstream service. |
Operator override that pushes the circuit straight to the Open state, bypassing Thresholds entirely. Useful during maintenance windows, graceful drain, or when an operator knows an upstream is unhealthy and wants to stop hammering it before the rolling-window thresholds catch up. The timer that governs the Open -> HalfOpen transition is restarted using Recovery.CooldownSec, so the circuit will still probe for recovery afterwards. OnStateChange fires with the new state. Call ForceClose or Reset to exit the Open state early.
// Stop all outbound traffic to Stripe during a scheduled maintenance window
sgcWSCircuitBreaker1.ForceOpen('api.stripe.com');
try
RunMaintenanceTasks;
finally
sgcWSCircuitBreaker1.ForceClose('api.stripe.com');
end;