Telemetry (telemetry/backoff_policy.rb)

flipper · lib/flipper/cloud/telemetry/backoff_policy.rb · ruby · MIT
analytics

Configurable exponential backoff with jitter for retry logic in distributed systems.

# Source: https://github.com/flippercloud/flipper | License: MIT | Copyright 2012 John Nunemaker
# Provided via justclaw.it.com; keep this notice with the code.
module Flipper
  module Cloud
    class Telemetry
      class BackoffPolicy
        # Private: The default minimum timeout between intervals in milliseconds.
        MIN_TIMEOUT_MS = 30_000

        # Private: The default maximum timeout between intervals in milliseconds.
        MAX_TIMEOUT_MS = 120_000

        # Private: The value to multiply the current interval with for each
        # retry attempt.
        MULTIPLIER = 1.5

        # Private: The randomization factor to use to create a range around the
        # retry interval.
        RANDOMIZATION_FACTOR = 0.5

        # Private
        attr_reader :min_timeout_ms, :max_tim

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key