1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Stop scheduler also on restart calibre-web

This commit is contained in:
Ozzie Isaacs 2023-01-29 09:54:07 +01:00
parent 9701a97a57
commit c4e4acfc26
2 changed files with 8 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import errno
import signal
import socket
import subprocess # nosec
from .services.background_scheduler import BackgroundScheduler
try:
from gevent.pywsgi import WSGIServer
@ -265,6 +266,12 @@ class WebServer(object):
subprocess.call(args, close_fds=True) # nosec
return True
@staticmethod
def shutdown_scheduler():
scheduler = BackgroundScheduler()
if scheduler:
scheduler.scheduler.shutdown()
def _killServer(self, __, ___):
self.stop()
@ -273,6 +280,7 @@ class WebServer(object):
updater_thread.stop()
log.info("webserver stop (restart=%s)", restart)
self.shutdown_scheduler()
self.restart = restart
if self.wsgiserver:
if _GEVENT:

View File

@ -45,8 +45,6 @@ class BackgroundScheduler:
cls.scheduler = BScheduler()
cls.scheduler.start()
atexit.register(lambda: cls.scheduler.shutdown())
return cls._instance
def schedule(self, func, trigger, name=None):