INNER CODE UNIT · Python
stop
MichielMe/fastscheduler · src/fastscheduler/main.py:315
def stop(self, wait: bool = True, timeout: int = 30):
"""Stop the scheduler gracefully."""
if not self.running:
return
logger.info("Stopping scheduler...")
self.running = False
if wait and self.thread and self.thread.is_alive():
self.thread.join(timeout=timeout)
if wait:
self._executor.shutdown(wait=True, cancel_futures=False)
self._save_executor.shutdown(wait=True)
else:
self._executor.shutdown(wait=False, cancel_futures=True)
self._save_executor.shutdown(wait=False)