TsgcWSCircuitBreakerMethods › ForceOpen

ForceOpen Method

Manually moves the circuit for the given key into the Open state.

Syntax

procedure ForceOpen(const aKey: string);

Parameters

NameTypeDescription
aKeyconst stringCircuit key to force Open — usually the hostname of the upstream service.

Remarks

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.

Example

// 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;

Back to Methods