background_tasks#
- class starlite.datastructures.background_tasks.BackgroundTask#
Bases:
object
A container for a ‘background’ task function.
Background tasks are called once a Response finishes.
- class starlite.datastructures.background_tasks.BackgroundTasks#
Bases:
object
A container for multiple ‘background’ task functions.
Background tasks are called once a Response finishes.
- __init__(tasks: Iterable[BackgroundTask], run_in_task_group: bool = False) None #
Initialize
BackgroundTasks
.- Parameters:
tasks – An iterable of
BackgroundTask
instances.run_in_task_group – If you set this value to
True
than the tasks will run concurrently, using an [anyio.task_group](https://anyio.readthedocs.io/en/stable/tasks.html). Note: this will not preserve execution order.