Archived
1
Fork 0

Dont need so many workers

This commit is contained in:
Jake Howard 2017-04-16 10:46:59 +01:00
parent b2818204ee
commit ec4b40bb81

View file

@ -2,7 +2,6 @@ from sanic import Sanic
from sanic_useragent import SanicUserAgent from sanic_useragent import SanicUserAgent
from lantern.args import parse_args from lantern.args import parse_args
from lantern.route import build_main_route from lantern.route import build_main_route
import os
app = Sanic(__name__) app = Sanic(__name__)
SanicUserAgent.init_app(app) SanicUserAgent.init_app(app)
@ -10,8 +9,7 @@ SanicUserAgent.init_app(app)
def main(): def main():
args = parse_args() args = parse_args()
workers = os.cpu_count() or 1
main_route = build_main_route(args) main_route = build_main_route(args)
app.add_route(main_route, "/<path>") app.add_route(main_route, "/<path>")
app.add_route(main_route, "/") app.add_route(main_route, "/")
app.run(host="0.0.0.0", port=args.port, workers=workers) app.run(host="0.0.0.0", port=args.port)