feat: リクエストタイムアウトの追加(応答がない場合の無期限ブロックを防止)#24
Open
aobathree wants to merge 1 commit into
Open
Conversation
従来は requests.get / requests.post に timeout が指定されておらず、 サーバーが応答しない場合にリクエストが無期限にブロックしていました。 - private API: config の 'timeout' キーで指定可能(省略時 30 秒) - public API: コンストラクタの timeout 引数で指定可能(省略時 30 秒) - いずれも None を指定すると従来どおりタイムアウトなし タイムアウト時は requests.exceptions.Timeout が送出されます。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
|
プルリクエストの作成ありがとうございます。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
requests.get/requests.postにtimeoutが指定されていないため、サーバーが応答しない場合にリクエストが無期限にブロックします。自動売買プログラム等に組み込んだ際、注文状態が不明のまま処理が停止するリスクがあるため、タイムアウトを追加しました。変更内容
configのtimeoutキーで指定可能(省略時 30 秒)timeout引数で指定可能(省略時 30 秒)Noneを指定すると従来どおりタイムアウトなしtimeoutの説明を追記互換性への影響
タイムアウト時は
requests.exceptions.Timeoutが送出されます。従来は無限に待機していた場面で新たに例外が発生し得るため、完全な従来挙動が必要な場合はtimeout: Noneを指定してください。デフォルト値(30 秒)は、正常なレスポンスには十分長く、ハングを検知するには十分短い値として選定しています。🤖 Generated with Claude Code