Skip to content

Commit

Permalink
better DD analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jun 22, 2024
1 parent 607cef9 commit 45901cb
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions app/adapters/osu_api_v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ async def log_osu_api_response(response: httpx.Response) -> None:

async def get_beatmap(beatmap_id: int) -> BeatmapExtended | None:
if beatmap_id in BEATMAPS_CACHE:
logging.info("Cache hit", extra={"resource": "beatmap", "id": beatmap_id})
logging.info(
"Cache result",
extra={"result": "hit", "resource": "beatmap", "id": beatmap_id},
)
return BEATMAPS_CACHE[beatmap_id]

logging.info("Cache miss", extra={"resource": "beatmap", "id": beatmap_id})
logging.info(
"Cache result",
extra={"result": "miss", "resource": "beatmap", "id": beatmap_id},
)

osu_api_response_data: dict[str, Any] | None = None
try:
Expand All @@ -93,10 +99,16 @@ async def get_beatmap(beatmap_id: int) -> BeatmapExtended | None:

async def get_beatmapset(beatmapset_id: int) -> BeatmapsetExtended | None:
if beatmapset_id in BEATMAPSETS_CACHE:
logging.info("Cache hit", extra={"resource": "beatmapset", "id": beatmapset_id})
logging.info(
"Cache result",
extra={"result": "hit", "resource": "beatmapset", "id": beatmapset_id},
)
return BEATMAPSETS_CACHE[beatmapset_id]

logging.info("Cache miss", extra={"resource": "beatmapset", "id": beatmapset_id})
logging.info(
"Cache result",
extra={"result": "miss", "resource": "beatmapset", "id": beatmapset_id},
)

osu_api_response_data: dict[str, Any] | None = None
try:
Expand Down

0 comments on commit 45901cb

Please sign in to comment.