mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(proxy/utils.py): don't keep connecting to db if connection already established
This commit is contained in:
parent
4094356d6f
commit
e898f3e49c
2 changed files with 7 additions and 3 deletions
|
@ -255,7 +255,7 @@ class PrismaClient:
|
|||
)
|
||||
## init logging object
|
||||
self.proxy_logging_obj = proxy_logging_obj
|
||||
|
||||
self.connected = False
|
||||
os.environ["DATABASE_URL"] = database_url
|
||||
# Save the current working directory
|
||||
original_dir = os.getcwd()
|
||||
|
@ -505,7 +505,11 @@ class PrismaClient:
|
|||
)
|
||||
async def connect(self):
|
||||
try:
|
||||
await self.db.connect()
|
||||
if self.connected == False:
|
||||
await self.db.connect()
|
||||
self.connected = True
|
||||
else:
|
||||
return
|
||||
except Exception as e:
|
||||
asyncio.create_task(
|
||||
self.proxy_logging_obj.failure_handler(original_exception=e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue