Skip to content

Commit 1bc352e

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 2db2821 commit 1bc352e

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:
@@ -248,6 +244,8 @@ def parse_arguments():
248244
if args.check:
249245
validate_config_only()
250246
else:
247+
setup_sighup_handler()
248+
251249
import uvicorn
252250

253251
configure_uvicorn_logging()

0 commit comments

Comments
 (0)