pyinfra/pyinfra/utils/retry.py

16 lines
350 B
Python

from pyinfra.config import CONFIG
from retry import retry as _retry
def retry(exception):
def decorator(fn):
@_retry(exception, tries=CONFIG.retry.tries, delay=CONFIG.retry.delay, jitter=tuple(CONFIG.retry.jitter))
def inner(*args, **kwargs):
return fn(*args, **kwargs)
return inner
return decorator