Skip to content

Commit

Permalink
Added back the explicit check for uWSGI running with threads disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Sep 18, 2023
1 parent be61a2e commit b1ec65e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/apscheduler/schedulers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ def start_in_background(self) -> None:
:raises RuntimeError: if the scheduler is not in the ``stopped`` state
"""
# Check if we're running under uWSGI with threads disabled
uwsgi_module = sys.modules.get("uwsgi")
if not getattr(uwsgi_module, "has_threads", True):
raise RuntimeError(
"The scheduler seems to be running under uWSGI, but threads have "
"been disabled. You must run uWSGI with the --enable-threads "
"option for the scheduler to work."
)

self._ensure_services_ready()
self._portal.call(self._async_scheduler.start_in_background)

Expand Down

0 comments on commit b1ec65e

Please sign in to comment.