details: https://code.tryton.org/tryton/commit/2763a98a25e4
branch: default
user: Cédric Krier <[email protected]>
date: Thu May 07 18:12:20 2026 +0200
description:
Delegate notification handling of worker to the backend
Since bb52a833e823 the backend provides methods to handle notification.
Closes #14821
diffstat:
trytond/trytond/worker.py | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (36 lines):
diff -r 6286497d452b -r 2763a98a25e4 trytond/trytond/worker.py
--- a/trytond/trytond/worker.py Wed May 06 17:25:44 2026 +0200
+++ b/trytond/trytond/worker.py Thu May 07 18:12:20 2026 +0200
@@ -40,6 +40,9 @@
def run(self, task_id):
return self.executor.submit(run_task, self.database.name, task_id)
+ def get_notifications(self):
+ return self.database.get_notifications(self.connection)
+
class TaskList(list):
def filter(self):
@@ -79,7 +82,8 @@
tasks = TaskList()
for queue in queues:
- selector.register(queue.connection, selectors.EVENT_READ)
+ selector.register(
+ queue.connection, selectors.EVENT_READ, data=queue)
while True:
timeout = options.timeout
@@ -104,10 +108,8 @@
break
else:
for key, _ in selector.select(timeout=timeout):
- connection = key.fileobj
- connection.poll()
- while connection.notifies:
- connection.notifies.pop(0)
+ queue = key.data
+ queue.get_notifications()
def initializer(database_names, worker=True):