File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ def __init__(
7171
7272 async def _run (self ) -> None :
7373 """Run the actor."""
74+ _logger .info ("Starting dispatch actor for microgrid %s" , self ._microgrid_id )
75+
7476 # Initial fetch
7577 await self ._fetch ()
7678
@@ -272,11 +274,16 @@ def _schedule_start(self, dispatch: Dispatch) -> None:
272274 return
273275
274276 # Schedule the next run
275- if next_run := dispatch .next_run :
276- heappush (self ._scheduled_events , (next_run , dispatch ))
277- _logger .debug ("Scheduled dispatch %s to start at %s" , dispatch .id , next_run )
278- else :
279- _logger .debug ("Dispatch %s has no next run" , dispatch .id )
277+ try :
278+ if next_run := dispatch .next_run :
279+ heappush (self ._scheduled_events , (next_run , dispatch ))
280+ _logger .debug (
281+ "Scheduled dispatch %s to start at %s" , dispatch .id , next_run
282+ )
283+ else :
284+ _logger .debug ("Dispatch %s has no next run" , dispatch .id )
285+ except ValueError as error :
286+ _logger .error ("Error scheduling dispatch %s: %s" , dispatch .id , error )
280287
281288 def _schedule_stop (self , dispatch : Dispatch ) -> None :
282289 """Schedule a dispatch to stop.
You can’t perform that action at this time.
0 commit comments