fix(user): fix missing greenlet when invalidating cache

This commit is contained in:
MingxuanGame
2025-11-09 09:35:21 +08:00
parent 20ccd3e979
commit 2bd770a995
4 changed files with 4 additions and 7 deletions

View File

@@ -49,9 +49,8 @@ async def upload_avatar(
await storage.write_file(storage_path, content, f"image/{format_}")
url = await storage.get_file_url(storage_path)
current_user.avatar_url = url
await session.commit()
await cache_service.invalidate_user_cache(current_user.id)
await session.commit()
return {
"url": url,

View File

@@ -50,9 +50,8 @@ async def upload_cover(
await storage.write_file(storage_path, content, f"image/{format_}")
url = await storage.get_file_url(storage_path)
current_user.cover = UserProfileCover(url=url)
await session.commit()
await cache_service.invalidate_user_cache(current_user.id)
await session.commit()
return {
"url": url,

View File

@@ -81,9 +81,8 @@ async def user_rename(
"previous_username": current_user.previous_usernames[-1],
}
session.add(rename_event)
await session.commit()
await cache_service.invalidate_user_cache(current_user.id)
await session.commit()
return None

View File

@@ -247,5 +247,5 @@ async def favourite_beatmapset(
db.add(favourite)
else:
await db.delete(existing_favourite)
await db.commit()
await cache_service.invalidate_user_beatmapsets_cache(current_user.id)
await db.commit()