Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/+race-condition.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update offset in process_page() which was causing a race condition in rare case.
4 changes: 2 additions & 2 deletions infrahub_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ async def filters(
async def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelationsNode]:
"""Process a single page of results."""
query_data = await InfrahubNode(client=self, schema=schema, branch=branch).generate_query_data(
offset=offset or page_offset,
offset=page_offset if offset is None else offset,
limit=limit or pagination_size,
filters=filters,
include=include,
Expand Down Expand Up @@ -1954,7 +1954,7 @@ def filters(
def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelationsNodeSync]:
"""Process a single page of results."""
query_data = InfrahubNodeSync(client=self, schema=schema, branch=branch).generate_query_data(
offset=offset or page_offset,
offset=page_offset if offset is None else offset,
limit=limit or pagination_size,
filters=filters,
include=include,
Expand Down
4 changes: 2 additions & 2 deletions infrahub_sdk/node/node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Iterable
from copy import copy
from copy import copy, deepcopy
from typing import TYPE_CHECKING, Any

from ..constants import InfrahubClientMode
Expand Down Expand Up @@ -397,7 +397,7 @@ def generate_query_data_init(
"edges": {"node": {"id": None, "hfid": None, "display_label": None, "__typename": None}},
}

data["@filters"] = filters or {}
data["@filters"] = deepcopy(filters) if filters is not None else {}

if order:
data["@filters"]["order"] = order
Expand Down