Skip to content

Commit 4947c70

Browse files
committed
fixes parallel query execution not considering filters
1 parent 6a00e5e commit 4947c70

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog/query-parallel.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fixes issue where using `parallel` query execution could lead to excessive and unneeded GraphQL queries

infrahub_sdk/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ async def process_batch() -> tuple[list[InfrahubNode], list[InfrahubNode]]:
786786
nodes = []
787787
related_nodes = []
788788
batch_process = await self.create_batch()
789-
count = await self.count(kind=schema.kind)
789+
count = await self.count(kind=schema.kind, **filters)
790790
total_pages = (count + pagination_size - 1) // pagination_size
791791

792792
for page_number in range(1, total_pages + 1):
@@ -1930,7 +1930,7 @@ def process_batch() -> tuple[list[InfrahubNodeSync], list[InfrahubNodeSync]]:
19301930
related_nodes = []
19311931
batch_process = self.create_batch()
19321932

1933-
count = self.count(kind=schema.kind)
1933+
count = self.count(kind=schema.kind, **filters)
19341934
total_pages = (count + pagination_size - 1) // pagination_size
19351935

19361936
for page_number in range(1, total_pages + 1):

0 commit comments

Comments
 (0)