indie-status-page/venv/lib/python3.11/site-packages/apscheduler/executors/gevent.py
IndieStatusBot 902133edd3 feat: indie status page MVP -- FastAPI + SQLite
- 8 DB models (services, incidents, monitors, subscribers, etc.)
- Full CRUD API for services, incidents, monitors
- Public status page with live data
- Incident detail page with timeline
- API key authentication
- Uptime monitoring scheduler
- 13 tests passing
- TECHNICAL_DESIGN.md with full spec
2026-04-25 05:00:00 +00:00

29 lines
761 B
Python

import sys
from apscheduler.executors.base import BaseExecutor, run_job
try:
import gevent
except ImportError as exc: # pragma: nocover
raise ImportError("GeventExecutor requires gevent installed") from exc
class GeventExecutor(BaseExecutor):
"""
Runs jobs as greenlets.
Plugin alias: ``gevent``
"""
def _do_submit_job(self, job, run_times):
def callback(greenlet):
try:
events = greenlet.get()
except BaseException:
self._run_job_error(job.id, *sys.exc_info()[1:])
else:
self._run_job_success(job.id, events)
gevent.spawn(
run_job, job, job._jobstore_alias, run_times, self._logger.name
).link(callback)