mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 15:15:37 +01:00
Updates for web_app
This commit is contained in:
@@ -6,6 +6,7 @@ from modules.stream_notifications import start as start_stream_notifications_mod
|
||||
|
||||
from core.mongo import mongo_manager
|
||||
from core.redis import redis_manager
|
||||
from core.broker import broker
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
@@ -25,6 +26,9 @@ async def main():
|
||||
await mongo_manager.init()
|
||||
await redis_manager.init()
|
||||
|
||||
if not broker.is_worker_process:
|
||||
await broker.startup()
|
||||
|
||||
if module == "games_list":
|
||||
await start_games_list_module()
|
||||
elif module == "stream_notifications":
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
from core.mongo import mongo_manager
|
||||
from core.redis import redis_manager
|
||||
from core.broker import broker
|
||||
|
||||
from .views import routes
|
||||
|
||||
|
||||
async def get_app() -> FastAPI:
|
||||
def get_app() -> FastAPI:
|
||||
app = FastAPI()
|
||||
|
||||
for route in routes:
|
||||
app.include_router(route)
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup_event():
|
||||
await mongo_manager.init()
|
||||
await redis_manager.init()
|
||||
|
||||
if not broker.is_worker_process:
|
||||
await broker.startup()
|
||||
|
||||
return app
|
||||
|
||||
|
||||
app = get_app()
|
||||
|
||||
Reference in New Issue
Block a user