Repository navigation
WIP: fix HTTP-date Retry-After handling - #135
Closed
Kayvan-Zahiri wants to merge 1 commit into
Closed
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
Contributor
|
Closing with #134, see the comment there for more details. |
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.
Description
One Line Summary
Honor HTTP-date Retry-After headers when retrying notifications, including past dates and obsolete HTTP-date formats.
Details
Motivation
Fixes #134. The retry helper currently parses only numeric delays. A valid 503/429 response asking the client to wait until a future HTTP date instead falls back to a one-second delay, retrying too early.
Keep existing numeric parsing and parse HTTP dates using
email.utils.parsedate_to_datetime. Treat timezone-free obsolete HTTP dates as UTC, calculate the remaining wall-clock delay, clamp past dates to zero, and retain exponential fallback for malformed headers.The standard-library parser avoids a local-time calculation bug observed in urllib3 1.25.3, the SDK's minimum declared version. No new dependency, public API, retryable status, or idempotency behavior is introduced.
Protocol reference: RFC 9110 section 10.2.3.
Testing
Manual testing
Automated local SDK execution with mocked API responses, clock, and sleep; human device testing is not claimed.
DefaultApi.create_notification_with_retrycases.pytest --cov=onesignal— 195 passed on Python 3.12 / urllib3 2.8.0.git diff --checkpass. Full supported Python/dependency matrix and hosted delivery were not run.Checklist
AI assistance: OpenAI Codex investigated, implemented, tested, and prepared this draft. Human verification is not claimed.