latest fix
This commit is contained in:
@@ -0,0 +1 @@
|
||||
387857
|
||||
+20
-52
@@ -2,28 +2,25 @@ import multiprocessing
|
||||
import os
|
||||
|
||||
# Server socket
|
||||
bind = "0.0.0.0:5042" # Same port as in your app.py
|
||||
bind = "0.0.0.0:5042"
|
||||
backlog = 2048
|
||||
|
||||
# Worker processes
|
||||
workers = multiprocessing.cpu_count() * 2 + 1 # Recommended formula for worker count
|
||||
worker_class = "uvicorn.workers.UvicornWorker" # Required for FastAPI
|
||||
workers = 4
|
||||
worker_class = "uvicorn.workers.UvicornWorker"
|
||||
worker_connections = 1000
|
||||
timeout = 30
|
||||
timeout = 120
|
||||
keepalive = 2
|
||||
|
||||
# Process naming
|
||||
proc_name = "firefighter"
|
||||
pythonpath = "."
|
||||
|
||||
# Logging
|
||||
accesslog = "logs/access.log"
|
||||
errorlog = "logs/error.log"
|
||||
loglevel = "info"
|
||||
|
||||
# Process naming
|
||||
proc_name = "fire_fighter_api"
|
||||
|
||||
# SSL (uncomment and configure if using HTTPS)
|
||||
# keyfile = "path/to/keyfile"
|
||||
# certfile = "path/to/certfile"
|
||||
|
||||
# Server mechanics
|
||||
daemon = False
|
||||
pidfile = "gunicorn.pid"
|
||||
@@ -32,46 +29,17 @@ user = None
|
||||
group = None
|
||||
tmp_upload_dir = None
|
||||
|
||||
# Server hooks
|
||||
def on_starting(server):
|
||||
"""
|
||||
Server startup hook
|
||||
"""
|
||||
# Create logs directory if it doesn't exist
|
||||
os.makedirs("logs", exist_ok=True)
|
||||
# Worker lifecycle
|
||||
max_requests = 1000
|
||||
max_requests_jitter = 50
|
||||
graceful_timeout = 30
|
||||
preload_app = True
|
||||
|
||||
def post_fork(server, worker):
|
||||
"""
|
||||
Worker initialization hook
|
||||
"""
|
||||
server.log.info("Worker spawned (pid: %s)", worker.pid)
|
||||
# Debug
|
||||
reload = False
|
||||
reload_engine = "auto"
|
||||
spew = False
|
||||
|
||||
def pre_fork(server, worker):
|
||||
"""
|
||||
Pre-fork hook
|
||||
"""
|
||||
pass
|
||||
|
||||
def pre_exec(server):
|
||||
"""
|
||||
Pre-exec hook
|
||||
"""
|
||||
server.log.info("Forked child, re-executing.")
|
||||
|
||||
def when_ready(server):
|
||||
"""
|
||||
Server ready hook
|
||||
"""
|
||||
server.log.info("Server is ready. Spawning workers")
|
||||
|
||||
def worker_int(worker):
|
||||
"""
|
||||
Worker interrupt hook
|
||||
"""
|
||||
worker.log.info("worker received INT or QUIT signal")
|
||||
|
||||
def worker_abort(worker):
|
||||
"""
|
||||
Worker abort hook
|
||||
"""
|
||||
worker.log.info("worker received SIGABRT signal")
|
||||
# Server mechanics
|
||||
check_config = False
|
||||
preload_app = True
|
||||
|
||||
Reference in New Issue
Block a user