From: Ricardo Dias Date: Tue, 20 Mar 2018 15:44:49 +0000 (+0000) Subject: mgr/dashboard: fix NotificationQueue waiting loop X-Git-Tag: v13.1.0~469^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=11b6c930287f5d261d4d7398171254c823ecc5af;p=ceph.git mgr/dashboard: fix NotificationQueue waiting loop Signed-off-by: Ricardo Dias --- diff --git a/src/pybind/mgr/dashboard/tools.py b/src/pybind/mgr/dashboard/tools.py index 115d7737f1dd..73fa4788fd6a 100644 --- a/src/pybind/mgr/dashboard/tools.py +++ b/src/pybind/mgr/dashboard/tools.py @@ -647,8 +647,8 @@ class NotificationQueue(threading.Thread): @classmethod def new_notification(cls, notify_type, notify_value): - cls._queue.append((notify_type, notify_value)) with cls._cond: + cls._queue.append((notify_type, notify_value)) cls._cond.notify() @classmethod @@ -674,7 +674,8 @@ class NotificationQueue(threading.Thread): pass self._notify_listeners(private_buffer) with self._cond: - self._cond.wait(1.0) + while self._running and not self._queue: + self._cond.wait() # flush remaining events logger.debug("NQ: flush remaining events: %s", len(self._queue)) self._notify_listeners(self._queue)