Skip to content
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

use retry after instead of calculating delay #166

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

ndurell
Copy link
Contributor

@ndurell ndurell commented Mar 23, 2024

Description

Check List

  • Are you changing anything with the public API?
  • Have you tested this change on real device?
  • Are your changes backwards compatible with previous SDK Versions?
  • Have you added unit test coverage for your changes?
  • Have you verified that your changes are compatible with all the operating system version this SDK currently supports?

Manual Test Plan

Supporting Materials

@ndurell ndurell requested a review from a team as a code owner March 23, 2024 16:55
@ndurell ndurell requested a review from ajaysubra March 23, 2024 16:55
@@ -112,7 +112,7 @@ func handleRequestError(
case let .retryWithBackoff(requestCount, totalCount, _):
requestRetryCount = requestCount + 1
totalRetryCount = totalCount + 1
nextBackoff = getDelaySeconds(for: totalRetryCount)
nextBackoff = retryAfter ?? getDelaySeconds(for: totalRetryCount)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we apply jitter to the retryAfter too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose if we needed jitter, the server could apply it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jason-myers-klaviyo do you have any opinion on whether the SDKs should apply a jitter on top of the Retry-After value? Does the Retry-After just represent the time till the steady state rate limit "resets" or is there more advanced logic to it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jitter longer than the seconds given would be fine and up to you. Nice to have I think

Jitter shorter will cause another 429 I think

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just the time until the steady windows reset IIRC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ya definitely only add jitter

@evan-masseau
Copy link
Contributor

For viz, the relevant android PR

Copy link
Contributor

@evan-masseau evan-masseau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add jitter (1-10s?) to server's Retry-After value

@ajaysubra
Copy link
Contributor

Add jitter (1-10s?) to server's Retry-After value

Added jitter to Retry-After. Will test it out in the morning.

Copy link
Contributor

@evan-masseau evan-masseau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just confirming if its been tested against a live 429 response from production

@ajaysubra ajaysubra merged commit 3624f41 into master Apr 9, 2024
8 of 9 checks passed
@ajaysubra ajaysubra deleted the noah/CHNL-6833/retry_behavior branch April 9, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants