]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix NotificationQueue waiting loop
authorRicardo Dias <rdias@suse.com>
Tue, 20 Mar 2018 15:44:49 +0000 (15:44 +0000)
committerRicardo Dias <rdias@suse.com>
Tue, 27 Mar 2018 12:45:41 +0000 (13:45 +0100)
Signed-off-by: Ricardo Dias <rdias@suse.com>
src/pybind/mgr/dashboard/tools.py

index 115d7737f1dd299abf9cf4950c6e3c7dcaca5b45..73fa4788fd6a9e99391f03f1c7f68862bccc30ed 100644 (file)
@@ -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)