forked from phoenix/litellm-mirror
(fix) stability imp: completion() timeout during high traffic, should not raise exception
This commit is contained in:
parent
e0116d2991
commit
ce4423e213
1 changed files with 9 additions and 2 deletions
|
@ -89,8 +89,15 @@ class _LoopWrapper(Thread):
|
|||
self.loop = asyncio.new_event_loop()
|
||||
|
||||
def run(self) -> None:
|
||||
try:
|
||||
self.loop.run_forever()
|
||||
self.loop.call_soon_threadsafe(self.loop.close)
|
||||
except Exception as e:
|
||||
# Log exception here
|
||||
pass
|
||||
finally:
|
||||
self.loop.close()
|
||||
asyncio.set_event_loop(None)
|
||||
|
||||
def stop_loop(self):
|
||||
for task in asyncio.all_tasks(self.loop):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue