Skip to content

Commit

Permalink
Merge pull request #233 from opsmill/wvd-20240110-fix-issue-parallel-…
Browse files Browse the repository at this point in the history
…query

fix issue with batch execution of queries not considering filters
  • Loading branch information
wvandeun authored Jan 13, 2025
2 parents b0f592d + 4947c70 commit e47a240
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/query-parallel.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fixes issue where using `parallel` query execution could lead to excessive and unneeded GraphQL queries
4 changes: 2 additions & 2 deletions infrahub_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,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)
count = await self.count(kind=schema.kind, **filters)
total_pages = (count + pagination_size - 1) // pagination_size

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

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

for page_number in range(1, total_pages + 1):
Expand Down

0 comments on commit e47a240

Please sign in to comment.