Skip to content

Commit

Permalink
logs on beatmap deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jun 30, 2024
1 parent 5603eda commit 06c55ab
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/usecases/akatsuki_beatmaps.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import time

from app import state
Expand Down Expand Up @@ -76,7 +77,10 @@ async def _update_from_osu_api(old_beatmap: AkatsukiBeatmap) -> AkatsukiBeatmap
)
if new_osu_api_v1_beatmap is None:
# it's now unsubmitted!

logging.info(
"Deleting unsubmitted beatmap",
extra={"beatmap": old_beatmap.model_dump()},
)
await state.database.execute(
"DELETE FROM beatmaps WHERE beatmap_md5 = :old_md5",
{"old_md5": old_beatmap.beatmap_md5},
Expand All @@ -91,6 +95,10 @@ async def _update_from_osu_api(old_beatmap: AkatsukiBeatmap) -> AkatsukiBeatmap
# handle deleting the old beatmap etc.
if new_beatmap.beatmap_md5 != old_beatmap.beatmap_md5:
# delete any instances of the old map
logging.info(
"Deleting old beatmap",
extra={"old_beatmap": old_beatmap.model_dump()},
)
await state.database.execute(
"DELETE FROM beatmaps WHERE beatmap_md5 = :old_md5",
{"old_md5": old_beatmap.beatmap_md5},
Expand Down

0 comments on commit 06c55ab

Please sign in to comment.