Strategies

Suppressed

Probabilistic shedding that grows with observed pressure.

Choose suppressed strategy when gradual shedding is preferable to binary rejection.

Dense paper request cards reach a gate where some continue to a service while excess cards are progressively diverted into a side channel.
Rising pressure increases the share of traffic shed instead of creating one abrupt cutoff.

Decisions

Suppression factor stays within 0.0..=1.0:

  • 0.0: no suppression pressure.
  • Values approaching 1.0: increasing denial probability.
  • 1.0: full suppression.

Calls return Allowed below pressure threshold or Suppressed { is_allowed, suppression_factor, .. }. Always use is_allowed as admission result.

Read state

get(key) returns SuppressedRateLimitSnapshot:

  • total: accepted plus declined live usage.
  • total_declined: declined live usage; never greater than total.
  • suppression_factor: current pressure.

Unknown keys return zero-valued snapshots without creating state. get_suppression_factor(key) likewise returns 0.0 for unknown keys.

Conditional updates

Suppressed limiters share set_if(...) and set_if_preserve_history(...) with absolute limiters. A comparator miss changes no state or cache. A matched update redefines hard window capacity. Replacement history starts with no declines; preserved partial buckets retain proportional declines using integer truncation. Additions represent accepted usage and add no declines.

The soft target comes from RateLimit × WindowSize; HardLimitFactor expands that target into the point where suppression reaches 1.0. See How Suppression Works for the pressure curve and tuning guidance.

Use absolute strategy when probabilistic outcomes are unsuitable.

To build the suppressed limiter without a provider, see Build one strategy directly.