after some testing, introduce multithreading

This commit is contained in:
Fabian Dill 2020-06-24 08:34:53 +02:00
parent 8367351c62
commit 647c802b2f
2 changed files with 4 additions and 1 deletions

View File

@ -29,4 +29,4 @@ if __name__ == "__main__":
if DEBUG:
app.run(debug=True, port=port)
else:
serve(app, port=port, threads=1)
serve(app, port=port, threads=app.config["WAITRESS_THREADS"])

View File

@ -31,6 +31,8 @@ app.config['MAX_CONTENT_LENGTH'] = 1 * 1024 * 1024 # 1 megabyte limit
# if you want persistent sessions on your server, make sure you make this a constant in your config.yaml
app.config["SECRET_KEY"] = os.urandom(32)
app.config['SESSION_PERMANENT'] = True
app.config[
"WAITRESS_THREADS"] = 10 # waitress uses one thread for I/O, these are for processing of views that then get sent
app.config["PONY"] = {
'provider': 'sqlite',
'filename': os.path.abspath('db.db3'),
@ -40,6 +42,7 @@ app.config["CACHE_TYPE"] = "simple"
cache = Cache(app)
# this local cache is risky business if app hosting is done with subprocesses as it will not sync. Waitress is fine though
multiworlds = {}