From f6daaff100e39ef5893620605d23c45ee4767228 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Wed, 13 Sep 2023 23:36:50 +0200 Subject: [PATCH 01/11] use "pointer" for getting the next batch of players --- src/api/v2/player.py | 21 ++++++++++++++++++--- src/app/repositories/player.py | 13 ++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/api/v2/player.py b/src/api/v2/player.py index 0ec8b5e..349d855 100644 --- a/src/api/v2/player.py +++ b/src/api/v2/player.py @@ -1,9 +1,9 @@ from fastapi import APIRouter, Query, status, Header, Request +from fastapi.exceptions import HTTPException from src.database.functions import verify_token from src.utils import logging_helpers from src.app.repositories.player import Player as RepositoryPlayer from src.app.schemas.player import Player as SchemaPlayer -from pydantic import BaseModel router = APIRouter(tags=["Player"]) @@ -30,8 +30,9 @@ async def get_player_data( @router.get("/players", response_model=list[SchemaPlayer]) async def get_many_players_data( request: Request, - page: int = Query(default=1, ge=1), + page: int = Query(default=None), page_size: int = Query(default=10, ge=1, le=10_000), + greater_than: int = Query(default=None), token: str = Header(...), ): await verify_token( @@ -40,8 +41,22 @@ async def get_many_players_data( route=logging_helpers.build_route_log_string(request), ) + if not any([page, greater_than]): + raise HTTPException( + status_code=status.HTTP_406_NOT_ACCEPTABLE, + detail="page or greater than required.", + ) + + if all([page, greater_than]): + raise HTTPException( + status_code=status.HTTP_406_NOT_ACCEPTABLE, + detail="either page or greater than.", + ) + repo = RepositoryPlayer() - data = await repo.read_many(page=page, page_size=page_size) + data = await repo.read_many( + page=page, page_size=page_size, greater_than=greater_than + ) return data diff --git a/src/app/repositories/player.py b/src/app/repositories/player.py index 884d7ac..b408bbc 100644 --- a/src/app/repositories/player.py +++ b/src/app/repositories/player.py @@ -112,11 +112,18 @@ async def delete(self, player_name: str): pass @handle_database_error - async def read_many(self, page: int = 1, page_size: int = 10): + async def read_many( + self, page: int = None, page_size: int = 10_000, greater_than: int = None + ): table = dbPlayer sql_select: Select = select(table) - sql_select = sql_select.limit(page_size).offset((page - 1) * page_size) + + if greater_than: + sql_select = sql_select.where(table.id > greater_than).limit(page_size) + + if page: + sql_select = sql_select.limit(page_size).offset((page - 1) * page_size) async with PLAYERDATA_ENGINE.get_session() as session: session: AsyncSession = session @@ -129,5 +136,5 @@ async def read_many(self, page: int = 1, page_size: int = 10): try: schema_data.append(SchemaPlayer.model_validate(row)) except ValidationError as e: - print(e) + logger.error(e) return schema_data From 362caf720971321f7f57ca1d16a01c034e4e3e07 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 14 Sep 2023 00:07:42 +0200 Subject: [PATCH 02/11] better error --- src/api/v2/player.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/v2/player.py b/src/api/v2/player.py index 349d855..5736fef 100644 --- a/src/api/v2/player.py +++ b/src/api/v2/player.py @@ -44,13 +44,13 @@ async def get_many_players_data( if not any([page, greater_than]): raise HTTPException( status_code=status.HTTP_406_NOT_ACCEPTABLE, - detail="page or greater than required.", + detail=f"page or greater than required, received: {page=}, {greater_than=}", ) if all([page, greater_than]): raise HTTPException( status_code=status.HTTP_406_NOT_ACCEPTABLE, - detail="either page or greater than.", + detail=f"either page or greater than not both can be set, received: {page=}, {greater_than=}", ) repo = RepositoryPlayer() From 1af28829b6ea175295480dd27b9d8bdc204c4cb6 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 14 Sep 2023 00:19:49 +0200 Subject: [PATCH 03/11] bug fix --- src/api/v2/player.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/v2/player.py b/src/api/v2/player.py index 5736fef..5563221 100644 --- a/src/api/v2/player.py +++ b/src/api/v2/player.py @@ -41,7 +41,7 @@ async def get_many_players_data( route=logging_helpers.build_route_log_string(request), ) - if not any([page, greater_than]): + if greater_than is None and page is None: raise HTTPException( status_code=status.HTTP_406_NOT_ACCEPTABLE, detail=f"page or greater than required, received: {page=}, {greater_than=}", From e097970b1e9aefe6b736302bd98d1d5f3669ac2a Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 21 Sep 2023 19:37:09 +0200 Subject: [PATCH 04/11] added greater than --- src/api/v1/hiscore.py | 5 +++++ src/core/config.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/v1/hiscore.py b/src/api/v1/hiscore.py index c1ca4c2..3e44665 100644 --- a/src/api/v1/hiscore.py +++ b/src/api/v1/hiscore.py @@ -193,6 +193,7 @@ async def get_latest_hiscore_data_by_player_features( confirmed_player: Optional[int] = Query(None, ge=0, le=1), label_id: Optional[int] = Query(None, ge=0), label_jagex: Optional[int] = Query(None, ge=0, le=5), + greater_than: Optional[int] = Query(None, ge=0), ): """ Select the latest hiscore data of multiple players by filtering on the player features. @@ -211,6 +212,7 @@ async def get_latest_hiscore_data_by_player_features( == confirmed_player == label_id == label_jagex + == greater_than ): raise HTTPException(status_code=404, detail="No param given") @@ -233,6 +235,9 @@ async def get_latest_hiscore_data_by_player_features( if not label_jagex is None: sql = sql.where(Player.label_jagex == label_jagex) + if not greater_than is None: + sql = sql.where(Player.id >= greater_than) + # paging sql = sql.limit(row_count).offset(row_count * (page - 1)) diff --git a/src/core/config.py b/src/core/config.py index 84cb3eb..c9232e7 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -13,7 +13,7 @@ sql_uri = os.environ.get("sql_uri") discord_sql_uri = os.environ.get("discord_sql_uri") token = os.environ.get("token") -kafka_url = os.environ.get("kafka_url", "localhost:9094") +kafka_url = os.environ.get("kafka_url", "127.0.0.1:9094") # setup logging file_handler = logging.FileHandler(filename="./error.log", mode="a") From 6c7a6dbaee1c803955b1f3943a8b857b01a890d0 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 21 Sep 2023 20:29:54 +0200 Subject: [PATCH 05/11] no kafka on dev --- src/core/config.py | 1 + src/core/server.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/config.py b/src/core/config.py index c9232e7..d23da63 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -14,6 +14,7 @@ discord_sql_uri = os.environ.get("discord_sql_uri") token = os.environ.get("token") kafka_url = os.environ.get("kafka_url", "127.0.0.1:9094") +env = os.environ.get("env", "DEV") # setup logging file_handler = logging.FileHandler(filename="./error.log", mode="a") diff --git a/src/core/server.py b/src/core/server.py index 563cddf..8f01362 100644 --- a/src/core/server.py +++ b/src/core/server.py @@ -100,6 +100,7 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE @app.on_event("startup") async def startup_event(): - logger.info("startup initiated") - highscore_processor = HighscoreProcessor(batch_size=100) - asyncio.ensure_future(highscore_processor.start()) + if config.env != "DEV": + logger.info("startup initiated") + highscore_processor = HighscoreProcessor(batch_size=100) + asyncio.ensure_future(highscore_processor.start()) From 3bceb19c08091633263ed2aac77048f91add1f76 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 21 Sep 2023 21:48:27 +0200 Subject: [PATCH 06/11] added highscore latest --- src/api/v2/highscore.py | 22 +++++++++ src/app/repositories/highscore_latest.py | 57 ++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 src/app/repositories/highscore_latest.py diff --git a/src/api/v2/highscore.py b/src/api/v2/highscore.py index 30f7b43..ba34ae8 100644 --- a/src/api/v2/highscore.py +++ b/src/api/v2/highscore.py @@ -4,6 +4,9 @@ from src.app.repositories.highscore import ( PlayerHiscoreData as RepositoryPlayerHiscoreData, ) +from src.app.repositories.highscore_latest import ( + PlayerHiscoreDataLatest as RepositoryPlayerHiscoreDataLatest, +) from src.app.schemas.highscore import PlayerHiscoreData as SchemaPlayerHiscoreData from pydantic import BaseModel @@ -29,6 +32,25 @@ async def get_highscore_data( return data +@router.get("/hiscore/latest", response_model=list[SchemaPlayerHiscoreData]) +async def get_highscore_data_latest( + request: Request, + gte_player_id: int = Query(ge=0, description="player id greater than or equal to"), + page: int = Query(default=None, ge=1), + page_size: int = Query(default=1000, ge=1), + token: str = Header(...), +): + await verify_token( + token, + verification="verify_ban", + route=logging_helpers.build_route_log_string(request), + ) + + repo = RepositoryPlayerHiscoreDataLatest() + data = await repo.read(gte_player_id=gte_player_id, page=page, page_size=page_size) + return data + + @router.post("/hiscore", status_code=status.HTTP_201_CREATED) async def post_highscore_data( request: Request, data: list[SchemaPlayerHiscoreData], token: str = Header(...) diff --git a/src/app/repositories/highscore_latest.py b/src/app/repositories/highscore_latest.py new file mode 100644 index 0000000..c400569 --- /dev/null +++ b/src/app/repositories/highscore_latest.py @@ -0,0 +1,57 @@ +import logging + +from fastapi.encoders import jsonable_encoder +from sqlalchemy import select +from sqlalchemy.ext.asyncio import AsyncSession + +from src.app.schemas.highscore import PlayerHiscoreData as SchemaHiscore +from src.database.database import PLAYERDATA_ENGINE +from src.database.functions import handle_database_error +from src.database.models import Player as dbPlayer +from src.database.models import PlayerHiscoreDataLatest as dbPlayerHiscoreDataLatest + +logger = logging.getLogger(__name__) + + +class PlayerHiscoreDataLatest: + def __init__(self): + pass + + @handle_database_error + async def read( + self, gte_player_id: int = None, page: int = None, page_size: int = None + ): + table = dbPlayerHiscoreDataLatest + + sql_select = select(table) + sql_select = sql_select.join( + target=dbPlayer, onclause=table.Player_id == dbPlayer.id + ) + sql_select = sql_select.order_by(table.Player_id.asc()) + + if gte_player_id: + sql_select = sql_select.where(table.Player_id >= gte_player_id) + + if page_size: + sql_select = sql_select.limit(page_size) + + if page is not None and page_size: + sql_select = sql_select.offset((page - 1) * page_size) + + async with PLAYERDATA_ENGINE.get_session() as session: + session: AsyncSession + # Execute the select query + result = await session.execute(sql_select) + + # Convert the query results to SchemaHiscore objects + schema_data = [] + for row in result.scalars().all(): + try: + row_dict: dict = jsonable_encoder(row) + row_dict = {k: v if v is not None else 0 for k, v in row_dict.items()} + model_row = SchemaHiscore.model_validate(row_dict) + schema_data.append(model_row) + except Exception as e: + logger.error({"error": str(e), "data": row_dict}) + + return schema_data From 109778fe875496a626a1f0f5bef080a3c8fdd271 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 21 Sep 2023 21:48:52 +0200 Subject: [PATCH 07/11] remove imports --- src/api/v2/player.py | 7 ++++--- src/app/repositories/highscore.py | 12 +++++------- src/app/repositories/player.py | 2 +- src/app/schemas/highscore.py | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/api/v2/player.py b/src/api/v2/player.py index 5563221..f5efc62 100644 --- a/src/api/v2/player.py +++ b/src/api/v2/player.py @@ -1,9 +1,10 @@ -from fastapi import APIRouter, Query, status, Header, Request +from fastapi import APIRouter, Header, Query, Request, status from fastapi.exceptions import HTTPException -from src.database.functions import verify_token -from src.utils import logging_helpers + from src.app.repositories.player import Player as RepositoryPlayer from src.app.schemas.player import Player as SchemaPlayer +from src.database.functions import verify_token +from src.utils import logging_helpers router = APIRouter(tags=["Player"]) diff --git a/src/app/repositories/highscore.py b/src/app/repositories/highscore.py index a331717..937bf6a 100644 --- a/src/app/repositories/highscore.py +++ b/src/app/repositories/highscore.py @@ -1,19 +1,17 @@ import logging -from pydantic import ValidationError -from sqlalchemy import delete, select, update, union_all +from pydantic import BaseModel, ValidationError +from sqlalchemy import select, union_all from sqlalchemy.dialects.mysql import insert from sqlalchemy.exc import OperationalError from sqlalchemy.ext.asyncio import AsyncResult, AsyncSession -from sqlalchemy.sql.expression import Delete, Insert, Select, Update, and_ +from sqlalchemy.sql.expression import Insert, Select, and_ from src.app.schemas.highscore import PlayerHiscoreData as SchemaHiscore -from src.app.schemas.player import Player as SchemaPlayer from src.database.database import PLAYERDATA_ENGINE +from src.database.functions import handle_database_error from src.database.models import Player as dbPlayer from src.database.models import playerHiscoreData as dbPlayerHiscoreData -from src.database.functions import handle_database_error -from pydantic import BaseModel logger = logging.getLogger(__name__) @@ -43,7 +41,7 @@ async def _get_unique(self, data: list[SchemaHiscore]) -> list[SchemaHiscore]: # Get an async session from the PLAYERDATA_ENGINE. async with PLAYERDATA_ENGINE.get_session() as session: # Cast the session to AsyncSession for type hinting. - session: AsyncSession = session + session: AsyncSession # Execute the final_query and fetch the results. result: AsyncResult = await session.execute(final_query) diff --git a/src/app/repositories/player.py b/src/app/repositories/player.py index b408bbc..a35ded0 100644 --- a/src/app/repositories/player.py +++ b/src/app/repositories/player.py @@ -126,7 +126,7 @@ async def read_many( sql_select = sql_select.limit(page_size).offset((page - 1) * page_size) async with PLAYERDATA_ENGINE.get_session() as session: - session: AsyncSession = session + session: AsyncSession # Execute the select query result: AsyncResult = await session.execute(sql_select) diff --git a/src/app/schemas/highscore.py b/src/app/schemas/highscore.py index 2fbb23f..0a92488 100644 --- a/src/app/schemas/highscore.py +++ b/src/app/schemas/highscore.py @@ -81,7 +81,7 @@ class PlayerHiscoreData(BaseModel): sarachnis: int scorpia: int skotizo: int - tempoross: int + tempoross: int = 0 the_gauntlet: int the_corrupted_gauntlet: int theatre_of_blood: int From c127fe1a4709d1cc0c458c42b02ee99c58877710 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Thu, 21 Sep 2023 22:54:55 +0200 Subject: [PATCH 08/11] profiling to dev --- notes.md | 4 ++-- src/core/config.py | 1 + src/core/server.py | 18 +++++++++++++++++- src/database/database.py | 5 +++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/notes.md b/notes.md index f9187c7..2f6fe41 100644 --- a/notes.md +++ b/notes.md @@ -21,8 +21,8 @@ git push ## windows creating a python venv to work in and install the project requirements ```sh -python -m venv .venv-win -.venv-win\Scripts\activate +python -m venv .venv +.venv\Scripts\activate python -m pip install --upgrade pip pip install -r requirements.txt ``` diff --git a/src/core/config.py b/src/core/config.py index d23da63..a82b3a1 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -15,6 +15,7 @@ token = os.environ.get("token") kafka_url = os.environ.get("kafka_url", "127.0.0.1:9094") env = os.environ.get("env", "DEV") +profiling = os.environ.get("profiling", 0) # setup logging file_handler = logging.FileHandler(filename="./error.log", mode="a") diff --git a/src/core/server.py b/src/core/server.py index 8f01362..d49548e 100644 --- a/src/core/server.py +++ b/src/core/server.py @@ -7,7 +7,8 @@ from fastapi.exceptions import RequestValidationError from fastapi.middleware import Middleware from fastapi.middleware.cors import CORSMiddleware -from fastapi.responses import JSONResponse +from fastapi.responses import JSONResponse, HTMLResponse +from pyinstrument import Profiler from src import api from src.core import config @@ -104,3 +105,18 @@ async def startup_event(): logger.info("startup initiated") highscore_processor = HighscoreProcessor(batch_size=100) asyncio.ensure_future(highscore_processor.start()) + + +if config.profiling and config.env == "DEV": + + @app.middleware("http") + async def profile_request(request: Request, call_next): + profiling = request.query_params.get("profile", False) + if profiling: + profiler = Profiler(interval=0.01, async_mode="enabled") + profiler.start() + await call_next(request) + profiler.stop() + return HTMLResponse(profiler.output_html()) + else: + return await call_next(request) diff --git a/src/database/database.py b/src/database/database.py index f3f7efd..d3d352a 100644 --- a/src/database/database.py +++ b/src/database/database.py @@ -37,8 +37,9 @@ def __get_engine(self, connection_string) -> AsyncEngine: poolclass=QueuePool, pool_pre_ping=True, pool_size=100, - max_overflow=5000, - pool_recycle=3600, + max_overflow=1000, + pool_recycle=299, + pool_timeout=30, ) return engine From 6c0e6a1c501dde9b1e2d4c414e241aec7da43843 Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:00:03 +0200 Subject: [PATCH 09/11] Revert "profiling to dev" This reverts commit c127fe1a4709d1cc0c458c42b02ee99c58877710. --- notes.md | 4 ++-- src/core/config.py | 1 - src/core/server.py | 18 +----------------- src/database/database.py | 5 ++--- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/notes.md b/notes.md index 2f6fe41..f9187c7 100644 --- a/notes.md +++ b/notes.md @@ -21,8 +21,8 @@ git push ## windows creating a python venv to work in and install the project requirements ```sh -python -m venv .venv -.venv\Scripts\activate +python -m venv .venv-win +.venv-win\Scripts\activate python -m pip install --upgrade pip pip install -r requirements.txt ``` diff --git a/src/core/config.py b/src/core/config.py index a82b3a1..d23da63 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -15,7 +15,6 @@ token = os.environ.get("token") kafka_url = os.environ.get("kafka_url", "127.0.0.1:9094") env = os.environ.get("env", "DEV") -profiling = os.environ.get("profiling", 0) # setup logging file_handler = logging.FileHandler(filename="./error.log", mode="a") diff --git a/src/core/server.py b/src/core/server.py index d49548e..8f01362 100644 --- a/src/core/server.py +++ b/src/core/server.py @@ -7,8 +7,7 @@ from fastapi.exceptions import RequestValidationError from fastapi.middleware import Middleware from fastapi.middleware.cors import CORSMiddleware -from fastapi.responses import JSONResponse, HTMLResponse -from pyinstrument import Profiler +from fastapi.responses import JSONResponse from src import api from src.core import config @@ -105,18 +104,3 @@ async def startup_event(): logger.info("startup initiated") highscore_processor = HighscoreProcessor(batch_size=100) asyncio.ensure_future(highscore_processor.start()) - - -if config.profiling and config.env == "DEV": - - @app.middleware("http") - async def profile_request(request: Request, call_next): - profiling = request.query_params.get("profile", False) - if profiling: - profiler = Profiler(interval=0.01, async_mode="enabled") - profiler.start() - await call_next(request) - profiler.stop() - return HTMLResponse(profiler.output_html()) - else: - return await call_next(request) diff --git a/src/database/database.py b/src/database/database.py index d3d352a..f3f7efd 100644 --- a/src/database/database.py +++ b/src/database/database.py @@ -37,9 +37,8 @@ def __get_engine(self, connection_string) -> AsyncEngine: poolclass=QueuePool, pool_pre_ping=True, pool_size=100, - max_overflow=1000, - pool_recycle=299, - pool_timeout=30, + max_overflow=5000, + pool_recycle=3600, ) return engine From ab8579afa8e53527efc0f29a67bb5f62264829b2 Mon Sep 17 00:00:00 2001 From: RusticPotato Date: Sun, 8 Oct 2023 10:45:41 -0400 Subject: [PATCH 10/11] keep kafka in same level as other services --- docker-compose.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d7a8b21..06ebfcf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,18 +17,18 @@ services: networks: - botdetector-network - kafka: - image: bitnami/kafka:latest - environment: - - ALLOW_PLAINTEXT_LISTENER=yes - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://localhost:9094 - - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true - ports: - - 9094:9094 - networks: - - botdetector-network + kafka: + image: bitnami/kafka:latest + environment: + - ALLOW_PLAINTEXT_LISTENER=yes + - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094 + - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT + - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://localhost:9094 + - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true + ports: + - 9094:9094 + networks: + - botdetector-network api: build: From 0f49f7ec4cd7de919e18f60071d9ed65c39ff95b Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Fri, 24 Nov 2023 00:20:32 +0100 Subject: [PATCH 11/11] disable kafka highscores --- src/core/server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/server.py b/src/core/server.py index 8f01362..16236f5 100644 --- a/src/core/server.py +++ b/src/core/server.py @@ -98,9 +98,9 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE return JSONResponse(content={"detail": error}, status_code=422) -@app.on_event("startup") -async def startup_event(): - if config.env != "DEV": - logger.info("startup initiated") - highscore_processor = HighscoreProcessor(batch_size=100) - asyncio.ensure_future(highscore_processor.start()) +# @app.on_event("startup") +# async def startup_event(): +# if config.env != "DEV": +# logger.info("startup initiated") +# highscore_processor = HighscoreProcessor(batch_size=100) +# asyncio.ensure_future(highscore_processor.start())