Fix gateway exit code to enable systemd auto-restart on connection failure
- Updated the start_gateway function to return a boolean indicating success or failure, allowing for better control over exit codes. - Modified the main function to handle gateway startup failures, ensuring systemd can automatically restart on transient errors. - Enhanced error handling in the hermes_cli gateway to exit with code 1 if the gateway fails to connect to any platform.
This commit is contained in:
parent
9b0f2a16ca
commit
62ba69a29d
2 changed files with 15 additions and 5 deletions
|
|
@ -360,7 +360,11 @@ def run_gateway(verbose: bool = False):
|
|||
print("└─────────────────────────────────────────────────────────┘")
|
||||
print()
|
||||
|
||||
asyncio.run(start_gateway())
|
||||
# Exit with code 1 if gateway fails to connect any platform,
|
||||
# so systemd Restart=on-failure will retry on transient errors
|
||||
success = asyncio.run(start_gateway())
|
||||
if not success:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue