-
Notifications
You must be signed in to change notification settings - Fork 119
[MBL-19602][S/T/P] Revision of API rate limit exceeded retrial logic #3809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MBL-19602][S/T/P] Revision of API rate limit exceeded retrial logic #3809
Conversation
Claude Code ReviewUpdated: 2025-12-14 ✅ Approved
|
BuildsCommit: Update APITests.swift (a521519) |
Release Note:None. Affected Apps: Student, Teacher, ParentBuilds: Student, Teacher, Parent
|
refs: MBL-19602 affects: Student, Teacher, Parent builds: Student, Teacher, Parent release note: None.
Claude Code ReviewUpdated: 2025-12-14
✅ Approved |
Claude Code ReviewUpdated: $(date) Summary: Rate limit retry logic improvements with randomized backoff and 429 support.
No critical issues found. ✅ |
petkybenedek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code +1
vargaat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA+1, http 429 errors were properly re-tried and the sync successfully finished.
rh12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code + 1
refs: MBL-19602
affects: Student, Teacher, Parent
builds: Student, Teacher, Parent
release note: None.
Background
The motive for this was created by the work on solving the issue of Course sync for this account:
https://instructure.atlassian.net/browse/MBL-19512
Multiple parallel requests seems to consistently fail with
429 Too Many Requests (Rate Limit Exceeded)error. Thus the need to rethink how retrial is being done just to leave a considerable time window between those to avoid such failures.Approach
As per this document was suggesting, headers (
x-request-cost&x-rate-limit-remaining) of URLResponse were examined for failed requests, to infer some logic on deciding the right time to wait until perform the next request but turned out we can't. The reason for that is thatx-request-costonly received for successful requests, with value ofx-rate-limit-remainingthat doesn't imply a possible issue along the road. Examples (cost: 0.09859950499787828, limit: 700). And this is expected since we are dealing with failures resulted by multiple costly requests happening at the same time.Therefore, so to break this unwanted parallelism without carrying on a massive refactor, I went back on applying the solution suggested here by @vargaat :
#3798 (review)
Test Plan
Use account mentioned in this ticket:
https://instructure.atlassian.net/browse/MBL-19512
To trigger course sync for offline mode, the sync should at least work for page contents with no issues. There still could be issues with media sync, but this to be resolved by other PR.
Also, the usual use cases of app (navigating modules, pages, announcements, ...etc, navigating assignments, submission, sending a message) should work with no issues.
Checklist