mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 18:21:30 +08:00
fix: log SIGTERM as info level, not warning
SIGTERM is expected during graceful shutdown and reload operations. Logging it as warning level causes unnecessary noise in error logs. SIGKILL remains at error level (suggests OOM), other signals at warning. Closes #3094
This commit is contained in:
parent
19d07bd4af
commit
bbc9bba95e
@ -551,8 +551,11 @@ class Arbiter:
|
||||
if sig == signal.SIGKILL:
|
||||
msg += " Perhaps out of memory?"
|
||||
self.log.error(msg)
|
||||
elif sig == signal.SIGTERM:
|
||||
# SIGTERM is expected during graceful shutdown
|
||||
self.log.info(msg)
|
||||
else:
|
||||
# SIGTERM/SIGQUIT are expected during shutdown
|
||||
# Other signals are unexpected
|
||||
self.log.warning(msg)
|
||||
|
||||
if exitcode is not None and exitcode != 0:
|
||||
|
||||
@ -407,8 +407,8 @@ class TestReapWorkers:
|
||||
mock_worker = mock.Mock()
|
||||
arbiter.WORKERS = {42: mock_worker}
|
||||
|
||||
# SIGTERM should be logged as warning (not error)
|
||||
with mock.patch.object(arbiter.log, 'warning') as mock_log:
|
||||
# SIGTERM should be logged as info (expected during graceful shutdown)
|
||||
with mock.patch.object(arbiter.log, 'info') as mock_log:
|
||||
arbiter.reap_workers()
|
||||
|
||||
# Should log the signal
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user