Skip to content

Commit bb9f47e

Browse files
committed
fixes parallel query execution not considering filters
1 parent f883e36 commit bb9f47e

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
@@ -781,7 +781,7 @@ async def process_batch() -> tuple[list[InfrahubNode], list[InfrahubNode]]:
781781
nodes = []
782782
related_nodes = []
783783
batch_process = await self.create_batch()
784-
count = await self.count(kind=schema.kind)
784+
count = await self.count(kind=schema.kind, **filters)
785785
total_pages = (count + pagination_size - 1) // pagination_size
786786

787787
for page_number in range(1, total_pages + 1):
@@ -1920,7 +1920,7 @@ def process_batch() -> tuple[list[InfrahubNodeSync], list[InfrahubNodeSync]]:
19201920
related_nodes = []
19211921
batch_process = self.create_batch()
19221922

1923-
count = self.count(kind=schema.kind)
1923+
count = self.count(kind=schema.kind, **filters)
19241924
total_pages = (count + pagination_size - 1) // pagination_size
19251925

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

0 commit comments

Comments
 (0)