@@ -140,8 +140,8 @@ async def check_server_state(server: Server, config: dict) -> Status:
140140 # ------------------------------------------------------------------
141141 now = datetime .now ()
142142 tz = (
143- ZoneInfo (config [ 'schedule' ] .get ('timezone' ))
144- if 'timezone' in config [ 'schedule' ]
143+ ZoneInfo (config .get ('timezone' ))
144+ if 'timezone' in config
145145 else None
146146 )
147147
@@ -155,9 +155,6 @@ async def check_server_state(server: Server, config: dict) -> Status:
155155 # 3. Walk through the schedule periods
156156 # ------------------------------------------------------------------
157157 for period , daystate in config ['schedule' ].items ():
158- if period == 'timezone' : # skip the optional tz key
159- continue
160-
161158 # Validate that the daystate string is 7 characters long
162159 if len (daystate ) != 7 :
163160 server .log .error (
@@ -602,14 +599,7 @@ def _handle_times(server: Server, config: dict, rconf: dict, warn_time: int) ->
602599 """
603600 if 'times' in rconf :
604601 option = 'times'
605- tz = next (
606- (
607- v
608- for k , v in config .get ("schedule" , {}).items ()
609- if k == "timezone"
610- ),
611- None ,
612- )
602+ tz = config .get ('timezone' )
613603 elif 'local_times' in rconf :
614604 option = 'local_times'
615605 tz = None
@@ -685,15 +675,11 @@ def _handle_cron(server: Server, config: dict, rconf: dict, warn_time: int) -> i
685675 """
686676 *cron* – evaluate the cron expression at the *restart_time* that would occur after *warn_time* seconds.
687677 """
688- tz = next (
689- (
690- v
691- for k , v in config .get ("schedule" , {}).items ()
692- if k == "timezone"
693- ),
694- None ,
678+ tzinfo = (
679+ ZoneInfo (config .get ('timezone' ))
680+ if 'timezone' in config
681+ else None
695682 )
696- tzinfo = ZoneInfo (tz ) if tz else None
697683 restart_time = datetime .now (tz = tzinfo ) + timedelta (seconds = warn_time )
698684 restart_time = restart_time .replace (second = 0 , microsecond = 0 )
699685
0 commit comments