@@ -269,11 +269,11 @@ async def _run(self) -> None:
269269 _logger .debug (
270270 "Received dispatch event: %s" , selected .message
271271 )
272- dispatch = Dispatch (selected .message .dispatch )
273- _existing_dispatch = self ._dispatches .get (dispatch .id )
272+ new_dispatch = Dispatch (selected .message .dispatch )
273+ _existing_dispatch = self ._dispatches .get (new_dispatch .id )
274274 is_new_or_newer = (
275275 _existing_dispatch is None
276- or dispatch .update_time > _existing_dispatch .update_time
276+ or new_dispatch .update_time > _existing_dispatch .update_time
277277 )
278278
279279 match selected .message .event :
@@ -282,43 +282,43 @@ async def _run(self) -> None:
282282 # was updated. The CREATE event is late in
283283 # this case
284284 if is_new_or_newer :
285- self ._dispatches [dispatch .id ] = dispatch
285+ self ._dispatches [new_dispatch .id ] = new_dispatch
286286 await self ._update_dispatch_schedule_and_notify (
287- dispatch , None , next_event_timer
287+ new_dispatch , None , next_event_timer
288288 )
289289 await self ._lifecycle_events_tx .send (
290- Created (dispatch = dispatch )
290+ Created (dispatch = new_dispatch )
291291 )
292292 case Event .UPDATED :
293293 # We might receive update before we fetched
294294 # the entry, so don't rely on it existing
295295 if is_new_or_newer :
296296 await self ._update_dispatch_schedule_and_notify (
297- dispatch ,
298- self ._dispatches .get (dispatch .id ),
297+ new_dispatch ,
298+ self ._dispatches .get (new_dispatch .id ),
299299 next_event_timer ,
300300 )
301- self ._dispatches [dispatch .id ] = dispatch
301+ self ._dispatches [new_dispatch .id ] = new_dispatch
302302 await self ._lifecycle_events_tx .send (
303- Updated (dispatch = dispatch )
303+ Updated (dispatch = new_dispatch )
304304 )
305305 case Event .DELETED :
306306 # The dispatch might already be deleted,
307307 # depending on the exact timing of fetch()
308308 # so we don't rely on it existing.
309309 if is_new_or_newer :
310- self ._dispatches .pop (dispatch .id , None )
310+ self ._dispatches .pop (new_dispatch .id , None )
311311
312312 self ._deleted_dispatches [
313- dispatch .id
313+ new_dispatch .id
314314 ] = datetime .now (timezone .utc )
315315
316316 await self ._update_dispatch_schedule_and_notify (
317- None , dispatch , next_event_timer
317+ None , new_dispatch , next_event_timer
318318 )
319319
320320 await self ._lifecycle_events_tx .send (
321- Deleted (dispatch = dispatch )
321+ Deleted (dispatch = new_dispatch )
322322 )
323323
324324 case StreamRetrying ():
0 commit comments