diff --git a/bots/check-mirroring b/bots/check-mirroring index 6e94b80..c1df878 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -350,4 +350,5 @@ if h_missing_z: logger.error("zulip: This suggests we have a zephyr=>zulip mirroring problem.") logger.error("zulip: aka the global class mirroring script has issues.") +zulip_client.deregister(queue_id) print_status_and_exit(1) diff --git a/zulip/__init__.py b/zulip/__init__.py index 6abb93e..bb81c7d 100644 --- a/zulip/__init__.py +++ b/zulip/__init__.py @@ -288,6 +288,9 @@ def _mk_subs(streams, **kwargs): def _mk_rm_subs(streams): return {'delete': streams} +def _mk_deregister(queue_id): + return {'queue_id': queue_id} + def _mk_events(event_types=None): if event_types is None: return dict() @@ -322,6 +325,7 @@ Client._register('update_message', method='PATCH', url='messages', make_request= Client._register('get_messages', method='GET', url='messages/latest', longpolling=True) Client._register('get_events', url='events', method='GET', longpolling=True, make_request=(lambda **kwargs: kwargs)) Client._register('register', make_request=_mk_events) +Client._register('deregister', url="events", method="DELETE", make_request=_mk_deregister) Client._register('get_profile', method='GET', url='users/me') Client._register('get_streams', method='GET', url='streams', make_request=_kwargs_to_dict) Client._register('get_members', method='GET', url='users')