Skip to content

Commit

Permalink
Move pipeline to be per-user
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Aug 4, 2024
1 parent 32b5ba2 commit b196ec6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ async def recalc_ranks() -> None:

country_ranking_keys = await get_all_country_rankings_keys(rank_key)

async with redis.pipeline() as pipe:
for user in users:
for user in users:
async with redis.pipeline() as pipe:
inactive_days = (
(start_time - user["latest_pp_awarded"]) / 60 / 60 / 24
)
Expand Down Expand Up @@ -134,7 +134,7 @@ async def recalc_ranks() -> None:
await pipe.zrem(rank_key, user["id"])
await pipe.zrem(user_country_rank_key, user["id"])

await pipe.execute()
await pipe.execute()

print(f"Recalculated all ranks in {time.time() - start_time:.2f} seconds")

Expand Down

0 comments on commit b196ec6

Please sign in to comment.