Skip to content

Commit 0e6ea0a

Browse files
roberthoenigtimabbott
authored andcommitted
api: Add comments clarifying the request logic.
1 parent a7bfe69 commit 0e6ea0a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

zulip/zulip/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@ def do_register():
581581
return (res['queue_id'], res['last_event_id'])
582582

583583
queue_id = None
584+
# Make long-polling requests with `get_events`. Once a request
585+
# has received an answer, pass it to the callback and before
586+
# making a new long-polling request.
584587
while True:
585588
if queue_id is None:
586589
(queue_id, last_event_id) = do_register()
@@ -607,7 +610,9 @@ def do_register():
607610
#
608611
# Reset queue_id to register a new event queue.
609612
queue_id = None
610-
# TODO: Make this back off once it's more reliable
613+
# Add a pause here to cover against potential bugs in this library
614+
# causing a DoS attack against a server when getting errors.
615+
# TODO: Make this back off exponentially.
611616
time.sleep(1)
612617
continue
613618

0 commit comments

Comments
 (0)