mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
fix: suppress noisy gevent SystemExit traceback on shutdown
When stopping gunicorn with Ctrl+C, the gevent worker's handle_quit() calls sys.exit(0) inside a greenlet, causing gevent to print a SystemExit traceback. Add a gunicorn config with post_worker_init hook that marks SystemExit as a non-error in gevent's hub. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
gunicorn.conf.py
Normal file
18
gunicorn.conf.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Gunicorn configuration for INTERCEPT."""
|
||||
|
||||
|
||||
def post_worker_init(worker):
|
||||
"""Suppress noisy SystemExit tracebacks during gevent worker shutdown.
|
||||
|
||||
When gunicorn receives SIGINT, the gevent worker's handle_quit()
|
||||
calls sys.exit(0) inside a greenlet. Gevent treats SystemExit as
|
||||
an error by default and prints a traceback. Adding it to NOT_ERROR
|
||||
silences this harmless noise.
|
||||
"""
|
||||
try:
|
||||
from gevent import get_hub
|
||||
hub = get_hub()
|
||||
if SystemExit not in hub.NOT_ERROR:
|
||||
hub.NOT_ERROR = hub.NOT_ERROR + (SystemExit,)
|
||||
except Exception:
|
||||
pass
|
||||
Reference in New Issue
Block a user