@@ -181,7 +181,7 @@ async def searcher(self):
181181 continue
182182
183183 @tasks .loop (minutes = 1 )
184- async def queue (self ):
184+ async def queue (self ) -> None :
185185 """The queue looks through each log in it and checks to see if the log has been completed.
186186
187187 Here are the conditions for a match being considered done (may change):
@@ -195,6 +195,11 @@ async def queue(self):
195195 queue_logs = await queue_db .find_all_items ()
196196 for queue_log in queue_logs :
197197 players = [Player (data = player ) for player in queue_log ["players" ]]
198+ log_data : dict = await LogsAPI .get_single_log (queue_log ["log_id" ])
199+ if not log_data ["success" ]:
200+ # Log must have been deleted between searcher and queue. Remove.
201+ await LogSearcher ._delete_queue_game (queue_log ["_id" ])
202+ continue
198203 full_log = FullLog (
199204 PartialLog (
200205 queue_log ["guild" ],
@@ -203,7 +208,7 @@ async def queue(self):
203208 queue_log ["timestamp" ],
204209 ),
205210 queue_log ["log_id" ],
206- await LogsAPI . get_single_log ( queue_log [ "log_id" ]) ,
211+ log_data ,
207212 )
208213
209214 if (round (time .time ()) - full_log .timestamp ) > 3600 :
@@ -219,17 +224,17 @@ async def queue(self):
219224
220225 @searcher .error
221226 @queue .error
222- async def loop_error_handler (self , exception : Exception ):
227+ async def loop_error_handler (self , _exception : Exception ):
223228 """Handles printing errors to console for the loop
224229
225230 Args:
226231 exception (Exception): The exception that was raised
227232 """
228233 print ("Error in loop:\n " )
229- print (exception .__class__ .__name__ )
230- print (exception .__cause__ )
231- print (exception )
232234 print (traceback .format_exc ())
235+ await self .bot .get_channel (1259641880015147028 ).send (
236+ f"Error in log loop: { traceback .format_exc ()} "
237+ )
233238
234239 async def log_failed_log (self , log : PartialLog , reason : str ):
235240 """Log a failed log to the database"""
0 commit comments