Add scheduler disable flag to troubleshoot timeout issue

- Add DISABLE_SCHEDULER environment variable to disable scheduler
- Set DISABLE_SCHEDULER=true in deployment to test if scheduler is causing hangs
- This is a temporary fix to isolate the problem

russell@unturf.com is the boss
This commit is contained in:
Russell Ballestrini 2025-08-08 21:32:52 -04:00
parent 1d855a966c
commit 3cede5ba07
2 changed files with 8 additions and 1 deletions

View file

@ -63,7 +63,7 @@ deploy:
[Service]
WorkingDirectory=${APP_DIR}
Environment="PATH=${VENV_DIR}/bin"
Environment="PATH=${VENV_DIR}/bin" "DISABLE_SCHEDULER=true"
ExecStart=${VENV_DIR}/bin/uwsgi \\
--master \\
--enable-threads \\

7
app.py
View file

@ -802,6 +802,13 @@ def scheduler_worker():
def start_scheduler():
"""Start the background scheduler."""
global scheduler_thread, scheduler_running
# Check if scheduler is disabled via environment variable
disable_scheduler = os.environ.get('DISABLE_SCHEDULER', '').lower() in ('true', '1', 'yes')
if disable_scheduler:
log.info("Scheduler disabled by DISABLE_SCHEDULER environment variable")
return
if not scheduler_running:
scheduler_running = True
scheduler_thread = threading.Thread(target=scheduler_worker, daemon=True)