int(retry_after) raises ValueError on a non-integer Retry-After value
还没有人认领这个 Issue。
评估
调研方向
从 shopify_app/graphql/admin_graphql.py 中 398 行和 454 行附近的同步和异步 admin_graphql_request 重试处理器开始。跟踪 Retry-After 的获取方式,然后确认十进制值或无效值不再以 ValueError 的形式逸出,并确认两个处理器都继续保持其重试或 GQLResult 行为。
由索引模型根据 Issue 内容生成。
描述
Summary
The 429 retry handlers in admin_graphql_request coerce Retry-After with int(), which raises ValueError on any value that is not a bare integer. HTTP permits a decimal seconds value as well as an HTTP-date, and decimal values are what Shopify's own rate-limited REST responses carry.
The exception is uncaught, so it propagates out of admin_graphql_request instead of being retried or returned as a GQLResult.
Version: shopifyapp 1.0.1 (sdist from PyPI).
Cause
shopify_app/graphql/admin_graphql.py:398 (sync):
time.sleep(int(retry_after))
and shopify_app/graphql/admin_graphql.py:454 (async):
await asyncio.sleep(int(retry_after))
Reproduction
>>> int("2.0")
Traceback (most recent call last):
...
ValueError: invalid literal for int() with base 10: '2.0'
Currently masked
This is not reachable today, because the header is never actually read: response_headers.get("Retry-After", "1") always returns its "1" default, for the reason described in #17.
That coupling is the reason this is worth filing on its own — repairing the header lookup alone turns a silent bug into an uncaught exception. The two are best addressed together.
Suggested fix
Parse defensively and fall back rather than raising:
try:
delay = float(retry_after)
except (TypeError, ValueError):
delay = 1.0
time.sleep(delay)
float() accepts the integer form as well, so it covers both spellings. If HTTP-date support is wanted, email.utils.parsedate_to_datetime handles that form.
- 主要语言
- Python
- 星标
- 17
- 派生
- 1
- 平均合并
- 4 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Shopify/shopify-app-python 的其他 Issue
-
devtools-gardener
难度 2/5 1-3 小时 新手友好度 78/100
查看 Shopify/shopify-app-python 的全部 Issue
相似的 Issue
-
deployment release-lag
难度 2/5 1-3 小时 新手友好度 68/100
nolte/kamerplanter#2047 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-plugin-claude-subscription-directsdk#94 ·
维护者通常 1 天内回复
-
namespace operations
难度 2/5 1-3 小时 新手友好度 72/100
EclipseFdn/open-vsx.org#13702 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复