From 97afd713e0fc1a8003a49886dde3cdf1281c5579 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 1 Aug 2024 15:42:06 +0000 Subject: [PATCH] nagios: Clean up after ourselves. This prevents building up a large number of messages in the database. --- .../zulip_app_frontend/check_send_receive_time | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time index 3568c52e70..c0749af44f 100755 --- a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time +++ b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time @@ -128,13 +128,15 @@ send_zulip( }, ) -msg_content: list[str] = [] - -while msg_to_send not in msg_content: +complete = False +while not complete: messages = get_zulips() seconds_diff = time.perf_counter() - time_start - - msg_content = [m["content"] for m in messages] + for m in messages: + if msg_to_send == m["content"]: + zulip_sender.delete_message(m["id"]) + complete = True + break zulip_recipient.deregister(queue_id)