Skip to content

Commit 13e8fa3

Browse files
committed
Refactor SIGHUP signal handler placement in main.py
- Moved the setup of the SIGHUP signal handler to the main execution block to ensure it is only set when the application is run directly, improving clarity and control over signal handling during application startup.
1 parent eedad61 commit 13e8fa3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ def handle_sighup(signum, frame):
4646
logger.info("SIGHUP signal not available on this platform")
4747

4848

49-
# Override uvicorn's signal handlers
50-
setup_sighup_handler()
51-
52-
5349
def validate_config_only():
5450
"""Validate configuration and exit"""
5551
try:
@@ -247,6 +243,8 @@ def parse_arguments():
247243
if args.check:
248244
validate_config_only()
249245
else:
246+
setup_sighup_handler()
247+
250248
import uvicorn
251249

252250
configure_uvicorn_logging()

0 commit comments

Comments
 (0)