diff --git a/main.py b/main.py new file mode 100755 index 0000000..ef9d168 --- /dev/null +++ b/main.py @@ -0,0 +1,19 @@ +import sys + +import uvicorn + +from world_boss.app.scheduler import scheduler + +if __name__ == "__main__": + workers = int(sys.argv[1]) + timeout_keep_alive = int(sys.argv[2]) + host = sys.argv[3] + port = int(sys.argv[4]) + scheduler.start() + uvicorn.run( + "world_boss.wsgi:app", + workers=workers, + timeout_keep_alive=timeout_keep_alive, + host=host, + port=port, + ) diff --git a/world_boss/wsgi.py b/world_boss/wsgi.py index 94e64df..9d045f7 100644 --- a/world_boss/wsgi.py +++ b/world_boss/wsgi.py @@ -4,7 +4,6 @@ from world_boss.app.api import api from world_boss.app.config import config from world_boss.app.graphql import graphql_app -from world_boss.app.scheduler import scheduler def create_app() -> FastAPI: @@ -20,8 +19,3 @@ def create_app() -> FastAPI: app = create_app() - - -@app.on_event("startup") -def startup_event(): - scheduler.start()