[Patchew-devel] [PATCH 12/16] maintainer: Add MessageQueued and MessageDropping events

Fam Zheng famz at redhat.com
Wed Nov 21 02:08:42 UTC 2018


These events are not used internally but is an interesting point where
users can receive notifications when the watched queue is updated.

Signed-off-by: Fam Zheng <famz at redhat.com>
---
 mods/maintainer.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index 665b074..6b09057 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -16,7 +16,7 @@ from mod import PatchewModule
 from api.models import Message, Queue, WatchedQuery
 from django.shortcuts import render
 from api.search import SearchEngine
-from event import register_handler
+from event import declare_event, register_handler, emit_event
 
 class MaintainerModule(PatchewModule):
     """ Project maintainer related tasks """
@@ -25,6 +25,12 @@ class MaintainerModule(PatchewModule):
 
     def __init__(self):
         register_handler("ResultUpdate", self.on_result_update)
+        declare_event("MessageQueued",
+                      message="Message added",
+                      queue="The updated queue")
+        declare_event("MessageDropping",
+                      message="Message to be dropped",
+                      queue="Message is about to be dropping from a queue")
 
     def _add_to_queue(self, user, m, queue):
         for x in [m] + list(m.get_patches()):
-- 
2.17.2




More information about the Patchew-devel mailing list