diff --git a/infrahub_sdk/client.py b/infrahub_sdk/client.py index a6ca397f..1fc65f7c 100644 --- a/infrahub_sdk/client.py +++ b/infrahub_sdk/client.py @@ -343,7 +343,6 @@ def _initialize(self) -> None: self.object_store = ObjectStore(self) self.store = NodeStore(default_branch=self.default_branch) self.task = InfrahubTaskManager(self) - self.concurrent_execution_limit = asyncio.Semaphore(self.max_concurrent_execution) self._request_method: AsyncRequester = self.config.requester or self._default_request_method self.group_context = InfrahubGroupContext(self) @@ -1599,8 +1598,7 @@ async def allocate_next_ip_prefix( async def create_batch(self, return_exceptions: bool = False) -> InfrahubBatch: return InfrahubBatch( - semaphore=self.concurrent_execution_limit, - return_exceptions=return_exceptions, + max_concurrent_execution=self.max_concurrent_execution, return_exceptions=return_exceptions ) async def get_list_repositories( diff --git a/infrahub_sdk/node/relationship.py b/infrahub_sdk/node/relationship.py index 8473a1cb..4867efdd 100644 --- a/infrahub_sdk/node/relationship.py +++ b/infrahub_sdk/node/relationship.py @@ -4,7 +4,6 @@ from collections.abc import Iterable from typing import TYPE_CHECKING, Any -from ..batch import InfrahubBatch from ..exceptions import ( Error, UninitializedError, @@ -166,7 +165,7 @@ async def fetch(self) -> None: raise Error("Unable to fetch the peer, id and/or typename are not defined") ids_per_kind_map[peer.typename].append(peer.id) - batch = InfrahubBatch(max_concurrent_execution=self.client.max_concurrent_execution) + batch = await self.client.create_batch() for kind, ids in ids_per_kind_map.items(): batch.add( task=self.client.filters, @@ -289,7 +288,6 @@ def fetch(self) -> None: raise Error("Unable to fetch the peer, id and/or typename are not defined") ids_per_kind_map[peer.typename].append(peer.id) - # Unlike Async, no need to create a new batch from scratch because we are not using a semaphore batch = self.client.create_batch() for kind, ids in ids_per_kind_map.items(): batch.add(