Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import time
from typing import Any, Callable, IO, List, Optional, Union, cast

from azure.core.exceptions import ResourceNotFoundError
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
from azure.core.polling import PollingMethod, LROPoller, NoPolling

from azure.confidentialledger._operations._operations import (
Expand Down Expand Up @@ -112,6 +112,14 @@ def run(self) -> None:

if not_retryable or self._not_found_count >= 3:
raise
Comment on lines 113 to 114
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code enforces the 404 retry limit using a monotonic _not_found_count, but the tests/docstrings describe the behavior as '3 consecutive 404s'. As implemented, non-consecutive 404s (e.g., 404 → 406 → 404 → 406 → 404) will still eventually hit the limit and fail. Please either (a) reset _not_found_count after any successful poll / any non-404 attempt (including the 406 transient path) to make it truly 'consecutive', or (b) update the docstrings/tests to explicitly state the limit is on the total number of 404s during a polling run.

Copilot uses AI. Check for mistakes.
except HttpResponseError as http_exception:
# 406: node knows the transaction but it hasn't committed yet.
# This is transient during transaction-status polling — treat as
# pending so the poller retries.
if http_exception.status_code == 406 and self._retry_not_found:
pass # stay in polling loop
else:
raise
if not self.finished():
time.sleep(self._polling_interval_s)
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import asyncio # pylint: disable=do-not-import-asyncio
from typing import Any, Callable, IO, Coroutine, List, Optional, Union, cast

from azure.core.exceptions import ResourceNotFoundError
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod

from azure.confidentialledger.aio._operations._operations import (
Expand Down Expand Up @@ -66,6 +66,14 @@ async def run(self) -> None:

if not_retryable or self._not_found_count >= 3:
raise
except HttpResponseError as http_exception:
# 406: node knows the transaction but it hasn't committed yet.
# This is transient during transaction-status polling — treat as
# pending so the poller retries.
if http_exception.status_code == 406 and self._retry_not_found:
pass # stay in polling loop
else:
raise
if not self.finished():
await asyncio.sleep(self._polling_interval_s)
except Exception:
Expand Down
Loading
Loading