Use multiple workers
This commit is contained in:
parent
205d58efc3
commit
2b92acbc2a
1 changed files with 3 additions and 2 deletions
|
@ -1,11 +1,12 @@
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
from lantern.route import main_route
|
from lantern.route import main_route
|
||||||
|
import os
|
||||||
|
|
||||||
app = Sanic(__name__)
|
app = Sanic(__name__)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
workers = int(os.cpu_count()) or 1
|
||||||
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="8000")
|
app.run(host="0.0.0.0", port=8000, workers=workers)
|
||||||
|
|
Reference in a new issue