Skip to content

Commit

Permalink
feat : log limits data before reseting
Browse files Browse the repository at this point in the history
  • Loading branch information
fredygerman committed Jan 25, 2025
1 parent a1de7fd commit 2b40201
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

async def reset_daily_limits():
redis_client = get_redis_client()
# Note: Maybe before deleting the keys, we can send a report of the daily usage to the admin
# Log all the keys and their values before deleting them
keys = await redis_client.keys("rate_limit:*")
for key in keys:
value = await redis_client.get(key)
logger.info(f"Key: {key}, Value: {value}")

This comment has been minimized.

Copy link
@jurmy24

jurmy24 Jan 27, 2025

Member

Hey! Looks good, though use logger.debug instead of logger.info for this type of stuff

This comment has been minimized.

Copy link
@fredygerman

fredygerman Jan 28, 2025

Author Collaborator

yes, I will change it to that

keys = await redis_client.keys("rate_limit:*")
for key in keys:
await redis_client.delete(key)
Expand Down

0 comments on commit 2b40201

Please sign in to comment.