(*args, **kwargs)
| 1314 | def decorator(func): |
| 1315 | @functools.wraps(func) |
| 1316 | def wrapper(*args, **kwargs): |
| 1317 | attempts = 0 |
| 1318 | local_delay = delay |
| 1319 | while attempts < max_attempts: |
| 1320 | try: |
| 1321 | return func(*args, **kwargs) |
| 1322 | except Exception as e: |
| 1323 | attempts += 1 |
| 1324 | if attempts == max_attempts: |
| 1325 | raise e |
| 1326 | print(f"Attempt {attempts} failed. Retrying in {local_delay} seconds...") |
| 1327 | time.sleep(local_delay) |
| 1328 | local_delay *= backoff |
| 1329 | return None |
| 1330 | |
| 1331 | return wrapper |
| 1332 |