fix: Fix mem leak in Graph process (#5751)

Fix mem leak in Graph process
This commit is contained in:
Christophe Bornet 2025-01-17 18:18:45 +01:00 committed by GitHub
commit b3fd941bf6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1515,11 +1515,10 @@ class Graph:
to_process = deque(first_layer)
layer_index = 0
chat_service = get_chat_service()
run_id = uuid.uuid4()
self.set_run_id(run_id)
self.set_run_id()
self.set_run_name()
await self.initialize_run()
lock = chat_service.async_cache_locks[self.run_id]
lock = asyncio.Lock()
while to_process:
current_batch = list(to_process) # Copy current deque items to a list
to_process.clear() # Clear the deque for new items