Repository navigation
fix: back off on 429s without a block duration instead of retrying after 5s - #205
Remper1997 wants to merge 1 commit into
Conversation
…ter 5s The Ariston cloud often answers HTTP 429 with a bare "Requests are blocked" body. The client then waited a fixed 5 seconds and retried, and the other coordinators resumed after the same 5 seconds, which kept the account blocked indefinitely (fustom/ariston-remotethermo-home-assistant-v3#545). - Without a known duration, do not retry inline; pause all requests on the instance for 60s, doubling per consecutive 429 up to 15 minutes, and reset after the next successful response. Concurrent requests rejected by the same block count as one strike. - Honour a delta-seconds Retry-After header when the body has no duration. - Raise RateLimitException (a ConnectionException subclass that keeps args == (429, content)) carrying retry_after, also when a request is skipped inside the block window, so callers can schedule their next poll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
321c13f to
99091ba
Compare
|
Closing this as a duplicate of #200 and #202, which I missed before opening it. Both cover the same unparsable-429 back-off and also cut the number of GALEVO menu requests, which this PR doesn't. Sorry for the noise. In case it helps the review, here is data from an affected setup (GALEVO heat pump, HA 2026.11.0, integration v0.20.9, default scan intervals). This was the account-wide
Note that the concurrency issue raised on #202 (an in-flight 429 with a short duration, or a 500 retry, bypassing an active cooldown because The Home Assistant side is in fustom/ariston-remotethermo-home-assistant-v3#558. It turns 429s into paced |
Problem
The Ariston cloud often answers HTTP 429 with a bare
Requests are blockedbody._parse_block_seconds()finds no duration, so the client waits a fixed 5 s and retries._blocked_untilis also set to only 5 s, so the other coordinators resume after the same 5 s. The account stays blocked indefinitely and all entities stay unavailable.Seen on a GALEVO heat pump (HA 2026.11, default scan intervals): in ~1.5 h there were 83
Rate limited (429) without parsable block duration; falling back to 5s waitwarnings and 23ConnectionException: (429, b'Requests are blocked')tracebacks. Reported in fustom/ariston-remotethermo-home-assistant-v3#545.Change
asyncio.gatherof properties and menu items) count as one strike.Retry-Afterheader: honoured (delta-seconds) when the body has no duration.blocked for N seconds): unchanged. Sleep N+1 s, retry once.RateLimitException(ConnectionException): exported fromariston. It keepsargs == (429, content), so existingerror.args[0]checks still work, and addsretry_after(seconds until the block window ends). It is raised both for a 429 response and when a request is skipped inside the block window. Callers like the HA coordinators can then schedule their next poll instead of hammering the cloud.Sync (
requests) and async (aiohttp) paths share the same logic (_register_rate_limit,_raise_if_blocked).Tests
python -m unittest discover -s tests: 102 tests OK.tests/test_rate_limit.pycovers:Retry-After;retry_afteron short-circuited requests.The new tests fail on the previous code.
Real-world check
Installed on an affected HA 2026.11 (GALEVO) together with the companion integration PR. After the restart the log shows
Rate limited (429) without a block duration (1 in a row); pausing requests for 60 seconds, and setup retries are spaced ≥60 s apart. The flood of 5 s retries and tracebacks is gone.A companion PR in the integration turns these into paced
UpdateFailed/ConfigEntryNotReady. It also works with the current library release.🤖 Generated with Claude Code