call_on_each_event: Do not pass heartbeat events to clients.
Heartbeat events are intended to be an invisible part of the Zulip longpolling protocol, not an event that an application should every process, so it makes sense to exclude them from the events we pass to this application. Reproducer: https://github.com/showell/zulip-api-examples/blob/main/heartbeat_bug.py. See https://chat.zulip.org/#narrow/stream/137-feedback/topic/api.20client.20silent.20failure for more context.
This commit is contained in:
parent
768959d633
commit
5b2b0617a6
1 changed files with 9 additions and 0 deletions
|
@ -819,6 +819,15 @@ class Client:
|
|||
|
||||
for event in res["events"]:
|
||||
last_event_id = max(last_event_id, int(event["id"]))
|
||||
|
||||
if event["type"] == "heartbeat":
|
||||
# Heartbeat events are sent to clients regardless
|
||||
# of the client's requested event types, and are
|
||||
# intended to be an internal part of the Zulip
|
||||
# longpolling protocol, not something that clients
|
||||
# need to handle.
|
||||
continue
|
||||
|
||||
callback(event)
|
||||
|
||||
def call_on_each_message(
|
||||
|
|
Loading…
Add table
Reference in a new issue