From 0e6ea0a439334274ed0630ca9dde69adfa1342d1 Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Fri, 6 Oct 2017 17:05:12 +0200 Subject: [PATCH] api: Add comments clarifying the request logic. --- zulip/zulip/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index 17f7724..dff17f2 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -581,6 +581,9 @@ class Client(object): return (res['queue_id'], res['last_event_id']) queue_id = None + # Make long-polling requests with `get_events`. Once a request + # has received an answer, pass it to the callback and before + # making a new long-polling request. while True: if queue_id is None: (queue_id, last_event_id) = do_register() @@ -607,7 +610,9 @@ class Client(object): # # Reset queue_id to register a new event queue. queue_id = None - # TODO: Make this back off once it's more reliable + # Add a pause here to cover against potential bugs in this library + # causing a DoS attack against a server when getting errors. + # TODO: Make this back off exponentially. time.sleep(1) continue