Skip to main content
Hyrex provides automatic retry mechanisms for tasks that fail due to transient errors. Configure retries using max_retries and retry_backoff parameters.

Basic Retries

Set max_retries to automatically retry failed tasks:
Any unhandled exception will trigger a retry. To prevent retries for specific errors, catch the exception and return an error response instead.

Backoff Strategies

Fixed Backoff

Exponential Backoff

Custom Backoff

Error Handlers

Use on_error callbacks to monitor failures without affecting retry behavior:
The on_error handler must accept either no arguments or exactly one Exception argument. The handler runs after each failure but doesn’t prevent retries.

Retry Context

Access retry information within tasks:

Selective Retry Behavior

Control which errors trigger retries:

Next Steps

Cron

Schedule recurring tasks

Monitoring

Monitor task execution and retries