QUOTA_EXCEEDED is not mapped to TooManyRequestsError, so rate limiting arrives untyped
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu trong response_handler.py tại ba ánh xạ lỗi và check_response, đặc biệt là ánh xạ TooManyRequestsError hiện có quanh dòng 60. Tái hiện trường hợp FakeResp từ issue, sau đó xác minh rằng phản hồi QUOTA_EXCEEDED tạo ra TooManyRequestsError thay vì OverkizError chung. Hoàn tất khi phản hồi giới hạn tốc độ thực tế được định kiểu nhất quán với đường dẫn back-off dự kiến.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🐛 The problem
The Overkiz cloud reports its polling quota with errorCode: QUOTA_EXCEEDED, which matches none of the three error maps in response_handler.py, so it falls through to the generic raise at the end of check_response:
pyoverkiz.exceptions.OverkizError: {'errorCode': 'QUOTA_EXCEEDED', 'error': 'Too many requests, try again later'}
TooManyRequestsError is only reachable for a different errorCode (response_handler.py:60):
("AUTHENTICATION_ERROR", "Too many requests", TooManyRequestsError),
So the one exception type that means "you are being rate limited" is never raised for the server's actual rate-limit response.
🔁 Reproduction
import asyncio
from pyoverkiz.response_handler import check_response
from pyoverkiz.exceptions import OverkizError, TooManyRequestsError
class FakeResp:
status = 403
url = "https://example/events/x/fetch"
async def json(self, content_type=None):
return {"errorCode": "QUOTA_EXCEEDED",
"error": "Too many requests, try again later"}
async def main():
try:
await check_response(FakeResp())
except TooManyRequestsError:
print("typed")
except OverkizError as err:
print("untyped:", err)
asyncio.run(main()) # -> untyped: {'errorCode': 'QUOTA_EXCEEDED', ...}
Why none of the maps catch it:
_ERROR_CODE_MESSAGE_MAP(:47) — has noQUOTA_EXCEEDEDentry_MESSAGE_FALLBACK_MAP(:104) — has"Too many executions"and"Too many attempts with an invalid token", but not"Too many requests"_ERROR_CODE_FALLBACK_MAP(:121) — onlyAUTHENTICATION_ERRORandRESOURCE_ACCESS_DENIED
📉 Why it matters
Callers cannot distinguish rate limiting from an unknown server error without string-matching the payload, so any back-off keyed on TooManyRequestsError silently never runs.
Measured on an Atlantic Cozytouch V2 hub (cloud API), eight commands issued in parallel to eight heaters, Home Assistant's overkiz integration:
| observed | |
|---|---|
fetch_events rate during the burst |
1.32 /s (documented limit: 1/s) |
| polling intervals under 1 s | 5, shortest 0.23 s |
QUOTA_EXCEEDED raised |
1 |
| commands that reached the hub | 5 / 8 |
Because the error arrives untyped:
- it surfaces as
Unexpected error fetching device events datawith a full traceback, rather than a handled rate-limit path - the coordinator keeps polling at the interval that hit the limit instead of slowing down
- the failed update marks every entity
unavailable, and Home Assistant then refuses the remaining service calls —Referenced entities ... are missing or not currently available— so three commands were silently dropped - worst state-delivery lag in that run was 28.97 s
✅ Suggested fix
Either map the code directly in _ERROR_CODE_MESSAGE_MAP:
("QUOTA_EXCEEDED", None, TooManyRequestsError),
…or, more robustly, add the message to _MESSAGE_FALLBACK_MAP so it matches whatever errorCode carries it:
("Too many requests", TooManyRequestsError),
The second also covers the existing AUTHENTICATION_ERROR variant, and any future code the cloud attaches to the same message.
🧾 Environment
pyoverkiz2.1.0- Hub: Atlantic Cozytouch V2 (
io://****-****-9776), cloud API — local API not available for this server - Seen on the
events/{listener_id}/fetchendpoint, documented as "1 calls per 1 SECONDS period for this particular operation (polling)"
Happy to open a PR for whichever form you prefer.
- Ngôn ngữ chính
- Python
- Star
- 58
- Fork
- 35
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của iMicknl/python-overkiz-api
-
blocked feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
iMicknl/python-overkiz-api#1525 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của iMicknl/python-overkiz-api
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
spec-kitty/spec-kitty#5319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend::vllm diffusion multimodal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
openai/openai-agents-python#5229 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày