Skip to content

Commit

Permalink
Use main.py avoid multiple scheduler run
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Sep 25, 2024
1 parent 1dd3d5a commit ddefba9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
19 changes: 19 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -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,
)
6 changes: 0 additions & 6 deletions world_boss/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,8 +19,3 @@ def create_app() -> FastAPI:


app = create_app()


@app.on_event("startup")
def startup_event():
scheduler.start()

0 comments on commit ddefba9

Please sign in to comment.