revert semaphore gather batching (#489)

This commit is contained in:
Preston Rasmussen 2025-05-14 15:33:11 -04:00 committed by GitHub
parent 8eff15a58a
commit ca75decc5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 17 deletions

View file

@ -93,21 +93,8 @@ async def semaphore_gather(
):
semaphore = asyncio.Semaphore(max_coroutines)
async def _wrap(coro: Coroutine) -> Any:
async def _wrap_coroutine(coroutine):
async with semaphore:
return await coro
return await coroutine
results = []
batch = []
for coroutine in coroutines:
batch.append(_wrap(coroutine))
# once we hit max_coroutines, gather and clear the batch
if len(batch) >= max_coroutines:
results.extend(await asyncio.gather(*batch))
batch.clear()
# gather any remaining coroutines in the final batch
if batch:
results.extend(await asyncio.gather(*batch))
return results
return await asyncio.gather(*(_wrap_coroutine(coroutine) for coroutine in coroutines))

View file

@ -1,7 +1,7 @@
[project]
name = "graphiti-core"
description = "A temporal graph building library"
version = "0.11.6pre8"
version = "0.11.6pre9"
authors = [
{ "name" = "Paul Paliychuk", "email" = "paul@getzep.com" },
{ "name" = "Preston Rasmussen", "email" = "preston@getzep.com" },