diff --git a/supervisord.py b/supervisord.py index ec5280befeef044a94c4eed41e8e50864e1a03ab_c3VwZXJ2aXNvcmQucHk=..57dc6804934f061dc3a3b91e33f0d5ade2433d8e_c3VwZXJ2aXNvcmQucHk= 100644 --- a/supervisord.py +++ b/supervisord.py @@ -44,6 +44,15 @@ TRUTHY_STRINGS = ('yes', 'true', 'on', '1') FALSY_STRINGS = ('no', 'false', 'off', '0') +timer_delay = starlet.bintim('0 0:00:01.00')[1] +timer_astctx = vmsast.AstContext(vmsast.M_WAKE | vmsast.M_QUEUE) + + +def start_timer(): + global timer_delay, timer_astctx + timer_astctx.reset() + starlet.setimr(daytim=timer_delay, reqidt=timer_astctx) + class RestartWhenExitUnexpected: pass @@ -637,6 +646,7 @@ def run(chan: int, chancmd: int, chancmd_r: int): + global timer_delay, timer_astctx astparam: AstParam with ( mbxqio.MBXQIO(channel=chan) as fterm, @@ -650,5 +660,4 @@ if pgm.autostart: pgm.create_process(False) - timer_astctx = vmsast.AstContext(vmsast.M_WAKE | vmsast.M_QUEUE) timer_astctx.param = AstParam(AstParamType.TIMER) @@ -654,4 +663,3 @@ timer_astctx.param = AstParam(AstParamType.TIMER) - timer_delay = starlet.bintim('0 0:00:01.00')[1] starlet.setimr(daytim=timer_delay, reqidt=timer_astctx) @@ -656,5 +664,6 @@ starlet.setimr(daytim=timer_delay, reqidt=timer_astctx) + timer_in_progress = True while True: ret_ast_context: vmsast.AstContext @@ -675,8 +684,11 @@ elif astparam.ptype == AstParamType.CMD: c_astctxt = qio_cmd(fcmd) # noqa: F841 elif astparam.ptype == AstParamType.TIMER: - timer_astctx.reset() - starlet.setimr(daytim=timer_delay, reqidt=timer_astctx) + timer_in_progress = False + + if timer_queue.not_empty and not timer_in_progress: + timer_in_progress = True + start_timer() def main():