copyWith method

ResilienceConfig copyWith({
  1. CheckStrategy? strategy,
  2. int? circuitBreakerThreshold,
  3. BigInt? circuitBreakerCooldownMs,
  4. int? numJitterSamples,
  5. double? jitterThresholdPercent,
  6. int? stabilityThershold,
  7. double? criticalPacketLossPrecent,
})

Creates a copy of ResilienceConfig with the given fields replaced by the new values.

strategy Evaluation strategy for multiple targets. circuitBreakerThreshold Number of failures before opening the circuit. circuitBreakerCooldownMs Duration to wait before trial checks. numJitterSamples Number of samples for stability analysis. jitterThresholdPercent Threshold for flagging high jitter. stabilityThershold Minimum stability score required. criticalPacketLossPrecent Packet loss threshold for unstable status.

Returns a new ResilienceConfig instance.

Implementation

ResilienceConfig copyWith({
  CheckStrategy? strategy,
  int? circuitBreakerThreshold,
  BigInt? circuitBreakerCooldownMs,
  int? numJitterSamples,
  double? jitterThresholdPercent,
  int? stabilityThershold,
  double? criticalPacketLossPrecent,
}) {
  return ResilienceConfig(
    strategy: strategy ?? this.strategy,
    circuitBreakerThreshold:
        circuitBreakerThreshold ?? this.circuitBreakerThreshold,
    circuitBreakerCooldownMs:
        circuitBreakerCooldownMs ?? this.circuitBreakerCooldownMs,
    numJitterSamples: numJitterSamples ?? this.numJitterSamples,
    jitterThresholdPercent:
        jitterThresholdPercent ?? this.jitterThresholdPercent,
    stabilityThershold: stabilityThershold ?? this.stabilityThershold,
    criticalPacketLossPrecent:
        criticalPacketLossPrecent ?? this.criticalPacketLossPrecent,
  );
}