Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

int(retry_after) raises ValueError on a non-integer Retry-After value

オープン 初心者向け
#18 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

shopify_app/graphql/admin_graphql.py の、398 行目と 454 行目付近にある admin_graphql_request の同期および非同期の retry ハンドラーから始めます。Retry-After の取得方法を追跡し、そのうえで、小数値または無効な値が ValueError として外部に漏れなくなっていること、また両方のハンドラーが引き続き retry または GQLResult の動作を維持していることを確認します。

索引モデルが issue の本文から書いたものです。

説明

devtools-gardener

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分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/shopify-app-python のほかの issue

Shopify/shopify-app-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。