Retry
Retry extension enqueues task again if it raised an exception.
from aiotaskqueue import Configuration, task
from aiotaskqueue.extensions.builtin import Retry, RetryExtension
from aiotaskqueue.serialization.msgspec import MsgSpecSerializer
@task(
name="name",
markers=[Retry(max_retries=3)], # (1)!
)
async def some_task() -> None:
pass
configuration = Configuration(
default_serialization_backend=MsgSpecSerializer(),
extensions=[RetryExtension()], # (2)!
)
- You need to add the
Retry
marker and configure amount of retries - Don't forget to add the extension into your configuration
Scheduling
On retry task is simply added to the queue again, so the following applies:
- Task may be scheduled on different node
- Task won't be retried immediately if there are any tasks in front of it in the queue