fix: better debug logs

This commit is contained in:
Krrish Dholakia 2024-03-19 19:28:26 -07:00
parent e0d3b18835
commit f6de3a0359
3 changed files with 13 additions and 8 deletions

View file

@ -1817,6 +1817,7 @@ async def reset_budget(prisma_client: PrismaClient):
Updates db
"""
verbose_proxy_logger.debug("ENTERS RESET BUDGET")
if prisma_client is not None:
### RESET KEY BUDGET ###
now = datetime.utcnow()
@ -1828,12 +1829,15 @@ async def reset_budget(prisma_client: PrismaClient):
)
### RESET USER BUDGET ###
asyncio.create_task(
prisma_client.db.litellm_usertable.update_many(
verbose_proxy_logger.debug("STARTS RESETTING USER BUDGET")
try:
await prisma_client.db.litellm_usertable.update_many(
where={"budget_reset_at": {"lt": now}},
data={"spend": 0, "budget_reset_at": now},
)
)
except Exception as e:
verbose_proxy_logger.debug(f"An exception occurs - {str(e)}")
raise e
async def update_spend(