From 43a4900e1f73b31d2e4dad6ee00068c4148fc92f Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Fri, 2 Aug 2024 13:44:29 -0400 Subject: [PATCH] zephyr: Delete DMs after they are received. --- zulip/integrations/zephyr/check-mirroring | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zulip/integrations/zephyr/check-mirroring b/zulip/integrations/zephyr/check-mirroring index 0876ec2b6..ca4a557a7 100755 --- a/zulip/integrations/zephyr/check-mirroring +++ b/zulip/integrations/zephyr/check-mirroring @@ -300,6 +300,11 @@ if "error" in res["result"]: logging.error(res["msg"]) print_status_and_exit(1) messages = [event["message"] for event in res["events"]] +for m in messages: + if m.get("stream_id") is None: + # Non-stream messages can't have a retention policy, so clean + # them up so they don't pile up + zulip_client.delete_message(m["id"]) logger.info("Finished receiving Zulip messages!") receive_zephyrs()