api: Add comments clarifying the request logic.

This commit is contained in:
derAnfaenger 2017-10-06 17:05:12 +02:00 committed by Tim Abbott
parent a7bfe692fa
commit 0e6ea0a439

View file

@ -581,6 +581,9 @@ class Client(object):
return (res['queue_id'], res['last_event_id']) return (res['queue_id'], res['last_event_id'])
queue_id = None 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: while True:
if queue_id is None: if queue_id is None:
(queue_id, last_event_id) = do_register() (queue_id, last_event_id) = do_register()
@ -607,7 +610,9 @@ class Client(object):
# #
# Reset queue_id to register a new event queue. # Reset queue_id to register a new event queue.
queue_id = None 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) time.sleep(1)
continue continue