nagios: Clean up after ourselves.

This prevents building up a large number of messages in the database.
This commit is contained in:
Alex Vandiver 2024-08-01 15:42:06 +00:00 committed by Tim Abbott
parent 1f045bc794
commit 97afd713e0
1 changed files with 7 additions and 5 deletions

View File

@ -128,13 +128,15 @@ send_zulip(
}, },
) )
msg_content: list[str] = [] complete = False
while not complete:
while msg_to_send not in msg_content:
messages = get_zulips() messages = get_zulips()
seconds_diff = time.perf_counter() - time_start seconds_diff = time.perf_counter() - time_start
for m in messages:
msg_content = [m["content"] for m in messages] if msg_to_send == m["content"]:
zulip_sender.delete_message(m["id"])
complete = True
break
zulip_recipient.deregister(queue_id) zulip_recipient.deregister(queue_id)