]> git.ipfire.org Git - pbs.git/commitdiff
users: Send push messages from the same task
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Jan 2025 10:35:34 +0000 (10:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Jan 2025 10:35:34 +0000 (10:35 +0000)
This is necessary because SQLAlchemy cannot delete the push
notification from a different task.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/users.py

index 6d098ae5fdda5d271f6988d103fa58b3a80465d6..23f7abf310e9b3a40ff2421da0db6e6a9812e3e1 100644 (file)
@@ -985,9 +985,8 @@ class User(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                message = self._make_message(title, body, **kwargs)
 
                # Send the message to all subscriptions
-               async with asyncio.TaskGroup() as tg:
-                       for subscription in self.subscriptions:
-                               tg.create_task(subscription.send(message))
+               for subscription in subscriptions:
+                       await subscription.send(message)
 
                return True