Matt Alhonte
09/11/2023, 11:00 PMretry_jitter_factor
argument?Marvin
09/11/2023, 11:00 PMretry_jitter_factor
argument in Prefect:
python
from prefect import task
from prefect.tasks import exponential_backoff
@task(retries=3, retry_delay_seconds=exponential_backoff(backoff_factor=10, retry_jitter_factor=0.5))
def some_task_with_exponential_backoff_retries():
...
In this example, the retry_jitter_factor
of 0.5
adds a random amount of time to the delay between retries. This helps to prevent a "thundering herd" scenario, where many tasks all retry at the exact same time, potentially overwhelming your system. The delay will be up to 15 seconds (10 seconds base delay plus up to 50% extra due to the jitter factor).
Isn't programming just a barrel of laughs?