Skip to content
Back to top
View this page
Edit this page

# Backoff

class valkey.backoff.AbstractBackoff

  Backoff interface

  abstractmethod compute(failures)

    Compute backoff in seconds upon failure

    Parameters:

      failures (int)

    Return type:

      float

  reset()

    Reset internal state before an operation. reset is called once at the beginning of every call to Retry.call_with_retry

class valkey.backoff.ConstantBackoff(backoff)

  Constant backoff upon failure

  Parameters:

    backoff (float)

  compute(failures)

    Compute backoff in seconds upon failure

    Parameters:

      failures (int)

    Return type:

      float

class valkey.backoff.DecorrelatedJitterBackoff(cap=0.512, base=0.008)

  Decorrelated jitter backoff upon failure

  Parameters:

    - cap (float)

    - base (float)

  compute(failures)

    Compute backoff in seconds upon failure

    Parameters:

      failures (int)

    Return type:

      float

  reset()

    Reset internal state before an operation. reset is called once at the beginning of every call to Retry.call_with_retry

    Return type:

      None

class valkey.backoff.EqualJitterBackoff(cap=0.512, base=0.008)

  Equal jitter backoff upon failure

  Parameters:

    - cap (float)

    - base (float)

  compute(failures)

    Compute backoff in seconds upon failure

    Parameters:

      failures (int)

    Return type:

      float

class valkey.backoff.ExponentialBackoff(cap=0.512, base=0.008)

  Exponential backoff upon failure

  Parameters:

    - cap (float)

    - base (float)

  compute(failures)

    Compute backoff in seconds upon failure

    Parameters:

      failures (int)

    Return type:

      float

class valkey.backoff.FullJitterBackoff(cap=0.512, base=0.008)

  Full jitter backoff upon failure

  Parameters:

    - cap (float)

    - base (float)

  compute(failures)

    Compute backoff in seconds upon failure

    Parameters:

      failures (int)

    Return type:

      float

class valkey.backoff.NoBackoff

  No backoff upon failure