Fix for updater

This commit is contained in:
Jack Darlington 2017-03-13 00:44:20 +00:00
parent 7d31abf920
commit 29462e2278
2 changed files with 15 additions and 3 deletions

View File

@ -341,6 +341,10 @@ class Updater(threading.Thread):
ub.session.close()
ub.engine.dispose()
self.status=6
if web.gevent_server:
web.gevent_server.stop()
else:
# stop tornado server
server = IOLoop.instance()
server.add_callback(server.stop)

View File

@ -198,6 +198,8 @@ mimetypes.add_type('image/vnd.djvu', '.djvu')
app = (Flask(__name__))
app.wsgi_app = ReverseProxied(app.wsgi_app)
gevent_server=None
formatter = logging.Formatter(
"[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
file_handler = RotatingFileHandler(os.path.join(config.get_main_dir, "calibre-web.log"), maxBytes=50000, backupCount=2)
@ -2683,3 +2685,9 @@ def upload():
book_in_shelfs = []
return render_title_template('detail.html', entry=db_book, cc=cc, title=db_book.title,
books_shelfs=book_in_shelfs, )
def start_gevent():
from gevent.wsgi import WSGIServer
global gevent_server
gevent_server = WSGIServer(('', ub.config.config_port), app)
gevent_server.serve_forever()