fix: fresh install archives stale state of a previous installation; a fatal Agent loop error stops the service instead of leaving a dead 'Running' one; 1.2.3
Found by uninstall + fresh install on the clean Windows Sandbox: the old agent_state.sqlite identity conflicted with the new enrollment and the service sat idle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,7 +81,14 @@ if win32serviceutil is not None:
|
||||
servicemanager.LogErrorMsg("GTIFiscalAgent: startup preflight failed; see the agent log")
|
||||
win32event.SetEvent(self.stop_event)
|
||||
return
|
||||
agent_service.run(config, os.environ, stopper=self.stop_flag)
|
||||
try:
|
||||
agent_service.run(config, os.environ, stopper=self.stop_flag)
|
||||
except BaseException as error: # noqa: BLE001 - a dead loop must never look like a healthy "Running" service
|
||||
import logging
|
||||
logging.getLogger("gti_fiscal_agent").exception("fatal error in the Agent loop; stopping the service")
|
||||
servicemanager.LogErrorMsg(f"GTIFiscalAgent: fatal error, stopping: {type(error).__name__}: {error}")
|
||||
self.stop_flag.stop = True
|
||||
win32event.SetEvent(self.stop_event)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user