throttle

package
v2.9.0-dev.507a93b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MinWaitDuration = 1 * time.Second

Variables

This section is empty.

Functions

func ApplyMinMaxDefaults

func ApplyMinMaxDefaults(sleepDuration time.Duration) time.Duration

func GenerateSleepDuration

func GenerateSleepDuration(backoffMultiplier int, timelineProvider timeutils.TimelineProvider) (sleepDuration time.Duration, humanReadableResetTimestamp string)

GenerateSleepDuration will generate a random sleep duration time between minWaitTime and minWaitTime * backoffMultiplier generated sleep durations are used in case the API did not reply with a limit and reset time and called with the current retry iteration count to implement increasing possible wait times per iteration

func ThrottleCallAfterError

func ThrottleCallAfterError(backoffMultiplier int, message string, a ...any)

ThrottleCallAfterError sleeps a bit after an error message to avoid hitting rate limits and getting the IP banned

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL