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

Add android retry #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add android retry #131

wants to merge 2 commits into from

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Dec 17, 2024

Summary

Add android retry to push proxy

Ticket Link

Fix https://mattermost.atlassian.net/browse/MM-56827

@larkox larkox added the 1: Dev Review Requires review by a core commiter label Dec 17, 2024
@larkox larkox requested review from agnivade and a team December 17, 2024 13:25
@lieut-data lieut-data removed the request for review from a team December 17, 2024 16:28
@agnivade
Copy link
Member

Hi @larkox - I've not been feeling well for the past few days. I hope you are not blocked on this review?

Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

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

Also wondering if there is a way to test this by setting up a mock HTTP server or something? I was looking at https://github.com/firebase/firebase-admin-go/blob/v3.13.0/internal/http_client_test.go but they have access to the client's internal fields so it doesn't help us.

defer cancelRetryContext()
_, err = me.client.Send(retryContext, fcmMsg)
if me.metrics != nil {
me.metrics.observerNotificationResponse(PushNotifyApple, time.Since(start).Seconds())
Copy link
Member

Choose a reason for hiding this comment

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

Wrong platform key.

Comment on lines +249 to +255
if err == nil {
break
}

if !isRetryable(err) {
break
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we combine these in an OR?

Comment on lines +259 to +262
if retries == MAX_RETRIES-1 {
me.logger.Errorf("Max retries reached did=%v", fcmMsg.Token)
break
}
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't the for loop take care of this? Why do we need an extra check? And if we do need it, can we remove the condition from the for loop?


select {
case <-generalContext.Done():
case <-time.After(waitTime):
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to incorporate some of this logic as well: https://github.com/firebase/firebase-admin-go/blob/54b81142d35e1b98cfd8687a9e56712c78a0f4ec/internal/http_client.go#L427-L438. We need to get the value of the Retry-After header and set that to be the minimum wait time to retry. Otherwise we will get a rate limited error again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1: Dev Review Requires review by a core commiter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants