MCPcopy
hub / github.com/encode/starlette / BackgroundTasks

Class BackgroundTasks

starlette/background.py:26–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class BackgroundTasks(BackgroundTask):
27 def __init__(self, tasks: Sequence[BackgroundTask] | None = None):
28 self.tasks = list(tasks) if tasks else []
29
30 def add_task(self, func: Callable[P, Any], *args: P.args, **kwargs: P.kwargs) -> None:
31 task = BackgroundTask(func, *args, **kwargs)
32 self.tasks.append(task)
33
34 async def __call__(self) -> None:
35 for task in self.tasks:
36 await task()

Callers 1

appFunction · 0.90

Calls

no outgoing calls

Tested by 1

appFunction · 0.72