Module slack_sdk.http_retry.jitter

Classes

class Jitter
Expand source code
class Jitter:
    """Jitter interface"""

    def recalculate(self, duration: float) -> float:
        """Recalculate the given duration.
        see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

        Args:
            duration: the duration in seconds

        Returns:
            A new duration that the jitter amount is added
        """
        raise NotImplementedError()

Jitter interface

Subclasses

Methods

def recalculate(self, duration: float) ‑> float
Expand source code
def recalculate(self, duration: float) -> float:
    """Recalculate the given duration.
    see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

    Args:
        duration: the duration in seconds

    Returns:
        A new duration that the jitter amount is added
    """
    raise NotImplementedError()

Recalculate the given duration. see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

Args

duration
the duration in seconds

Returns

A new duration that the jitter amount is added

class RandomJitter
Expand source code
class RandomJitter(Jitter):
    """Random jitter implementation"""

    def recalculate(self, duration: float) -> float:
        return duration + random.random()

Random jitter implementation

Ancestors

Inherited members