Delegate notification handling of worker to the backend

Since bb52a833e823 the backend provides methods to handle notification.

Closes #14821
(grafted from 2763a98a25e401887fb9ac5049ce21d97b622f66)

--HG--
branch : 8.0
This commit is contained in:
Cédric Krier
2026-05-07 18:12:20 +02:00
parent aea78aff43
commit dc2aaeec41
+7 -5
View File
@@ -40,6 +40,9 @@ class Queue(object):
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 @@ def work(options):
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 @@ def work(options):
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):