From 30b54da66adafc9900912ce97a3dc8bfb425c715 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Tue, 18 Jun 2024 15:48:07 +0200 Subject: [PATCH] async_helpers: only pass a single positional argument to create_task asyncio.create_task only accepts one positional argument and passing more than one results in the following exception: TypeError: create_task() takes 1 positional argument but 2 were given Therefore, it does not make sense for run_bg_task to forward *args to it. Signed-off-by: Olivier Gayot --- subiquitycore/async_helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subiquitycore/async_helpers.py b/subiquitycore/async_helpers.py index 3407e1fb5..b94f1ab06 100644 --- a/subiquitycore/async_helpers.py +++ b/subiquitycore/async_helpers.py @@ -45,9 +45,9 @@ def schedule_task(coro, propagate_errors=True): background_tasks = set() -def run_bg_task(coro, *args, **kwargs) -> None: +def run_bg_task(coro, **kwargs) -> None: """Run a background task in a fire-and-forget style.""" - task = asyncio.create_task(coro, *args, **kwargs) + task = asyncio.create_task(coro, **kwargs) background_tasks.add(task) task.add_done_callback(background_tasks.discard)