When I use Ctrl+C to stop my service, it also terminates the Python interpreter. This causes issues with proper cleanup and resource management, especially with Redis connection pools and other resources that require graceful shutdown. I'm running my FastAPI application with Gunicorn using the following command:
When I use Ctrl+C to stop my service, it also terminates the Python interpreter. This causes issues with proper cleanup and resource management, especially with Redis connection pools and other resources that require graceful shutdown. I'm running my FastAPI application with Gunicorn using the following command:
gunicorn app:app -c gunicorn.conf.py --enable-stdio-inheritance --reload
gunicorn.conf.py
from application.logger import LOGGING
bind = "127.0.0.1" workers = 4 worker_class = "uvicorn.workers.UvicornWorker" loglevel = "info" log_config = LOGGING