From c663f2f646f18e1c8fe02a738fbceb5a20129671 Mon Sep 17 00:00:00 2001 From: Martin Bornhold Date: Mon, 17 Oct 2016 10:45:13 +0200 Subject: [PATCH] events: Add comments to the subcriber classes. --- rhodecode/subscribers.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rhodecode/subscribers.py b/rhodecode/subscribers.py index 18e7043d..433a68fe 100644 --- a/rhodecode/subscribers.py +++ b/rhodecode/subscribers.py @@ -78,6 +78,9 @@ def scan_repositories_if_enabled(event): class Subscriber(object): + """ + Base class for subscribers to the pyramid event system. + """ def __call__(self, event): self.run(event) @@ -86,6 +89,12 @@ class Subscriber(object): class AsyncSubscriber(Subscriber): + """ + Subscriber that handles the execution of events in a separate task to not + block the execution of the code which triggers the event. It puts the + received events into a queue from which the worker process takes them in + order. + """ def __init__(self): self._stop = False self._eventq = Queue.Queue() @@ -113,6 +122,10 @@ class AsyncSubscriber(Subscriber): class AsyncSubprocessSubscriber(AsyncSubscriber): + """ + Subscriber that uses the subprocess32 module to execute a command if an + event is received. Events are handled asynchronously. + """ def __init__(self, cmd, timeout=None): super(AsyncSubprocessSubscriber, self).__init__()