gunicorn.conf.py 437 B

1234567891011121314151617
  1. import time
  2. import os
  3. bind = '0.0.0.0:8349'
  4. workers = os.environ.get("WORKERS", "2")
  5. timeout = os.environ.get("TIMEOUT", "180")
  6. preload_app = True
  7. def on_starting(server):
  8. worker_count = int(workers)
  9. # Insert a 2-second gap between workers
  10. gap_duration = 2
  11. for i in range(worker_count):
  12. # Add a delay between each worker
  13. time.sleep(gap_duration)
  14. print(f"Starting worker {i + 1}/{worker_count}")