diff --git a/graphiti_core/helpers.py b/graphiti_core/helpers.py index 86c27adb..92fb0b4b 100644 --- a/graphiti_core/helpers.py +++ b/graphiti_core/helpers.py @@ -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)) diff --git a/pyproject.toml b/pyproject.toml index ac73adfd..2da24413 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" },