From 2b92acbc2a30648254581728ff3d7b4220bfda8f Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 11 Apr 2017 09:25:54 +0100 Subject: [PATCH] Use multiple workers --- lantern/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lantern/main.py b/lantern/main.py index 10dfe32..8f444ce 100644 --- a/lantern/main.py +++ b/lantern/main.py @@ -1,11 +1,12 @@ from sanic import Sanic from lantern.route import main_route - +import os app = Sanic(__name__) def main(): + workers = int(os.cpu_count()) or 1 app.add_route(main_route, "/") app.add_route(main_route, "/") - app.run(host="0.0.0.0", port="8000") + app.run(host="0.0.0.0", port=8000, workers=workers)