diff --git a/changelog/+branch-in-count.fixed.md b/changelog/+branch-in-count.fixed.md new file mode 100644 index 00000000..b4227386 --- /dev/null +++ b/changelog/+branch-in-count.fixed.md @@ -0,0 +1 @@ +Update internal calls to `count` to include the branch parameter so that the query is performed on the correct branch \ No newline at end of file diff --git a/infrahub_sdk/client.py b/infrahub_sdk/client.py index 79974549..16c1c73a 100644 --- a/infrahub_sdk/client.py +++ b/infrahub_sdk/client.py @@ -824,7 +824,7 @@ async def process_batch() -> tuple[list[InfrahubNode], list[InfrahubNode]]: nodes = [] related_nodes = [] batch_process = await self.create_batch() - count = await self.count(kind=schema.kind, partial_match=partial_match, **filters) + count = await self.count(kind=schema.kind, branch=branch, partial_match=partial_match, **filters) total_pages = (count + pagination_size - 1) // pagination_size for page_number in range(1, total_pages + 1): @@ -1989,7 +1989,7 @@ def process_batch() -> tuple[list[InfrahubNodeSync], list[InfrahubNodeSync]]: related_nodes = [] batch_process = self.create_batch() - count = self.count(kind=schema.kind, partial_match=partial_match, **filters) + count = self.count(kind=schema.kind, branch=branch, partial_match=partial_match, **filters) total_pages = (count + pagination_size - 1) // pagination_size for page_number in range(1, total_pages + 1):