From d1bb2c5a9293e381fa9f78ea31c20b5345682a72 Mon Sep 17 00:00:00 2001 From: skelmis Date: Thu, 11 Jan 2024 23:03:04 +1300 Subject: [PATCH] fix: exceptions as a result of an edit race condition --- suggestions/clunk2/edits.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/suggestions/clunk2/edits.py b/suggestions/clunk2/edits.py index 9014983..9149c21 100644 --- a/suggestions/clunk2/edits.py +++ b/suggestions/clunk2/edits.py @@ -29,6 +29,16 @@ async def update_suggestion_message( pending_edits.add(suggestion.suggestion_id) await asyncio.sleep(time_after) + if suggestion.channel_id is None or suggestion.message_id is None: + log.debug( + "Suggestion %s had a NoneType by the time it was to be edited channel_id=%s, message_id=%s", + suggestion.suggestion_id, + suggestion.channel_id, + suggestion.message_id, + ) + pending_edits.discard(suggestion.suggestion_id) + return + try: await MessageEditing( bot, channel_id=suggestion.channel_id, message_id=suggestion.message_id