Skip to content

Commit

Permalink
fix: exceptions as a result of an edit race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Skelmis committed Jan 11, 2024
1 parent 0195bd1 commit d1bb2c5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions suggestions/clunk2/edits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1bb2c5

Please sign in to comment.