api: Add comments clarifying the request logic.
@@ -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
