Performance: Task retry and error handling
MEDIUM IMPACT
This affects backend task execution speed and user experience by controlling how failed tasks are retried and errors are handled.
from celery import shared_task @shared_task(bind=True, max_retries=3, default_retry_delay=10) def process_task(self): try: # task logic pass except Exception as exc: raise self.retry(exc=exc)
from time import sleep def process_task(): try: # task logic pass except Exception: sleep(10) # naive retry delay process_task() # recursive retry without limit
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Blocking recursive retry | 0 | 0 | 0 | [X] Bad |
| Asynchronous retry with limits (Celery) | 0 | 0 | 0 | [OK] Good |