Check status of response before retry send push (#507)

This commit is contained in:
Romanenko Alexey 2020-05-06 18:37:06 +07:00 committed by GitHub
parent c8ce081803
commit 20a9d18ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -389,7 +389,11 @@ Retry:
}
StatStorage.AddIosError(1)
newTokens = append(newTokens, token)
// We should retry only "retryable" statuses. More info about response:
// https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns
if res.StatusCode >= http.StatusInternalServerError {
newTokens = append(newTokens, token)
}
isError = true
}

View File

@ -164,8 +164,13 @@ Retry:
}
if result.Error != nil {
// We should retry only "retryable" statuses. More info about response:
// https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-plain-text
if !result.Unregistered() {
newTokens = append(newTokens, to)
}
isError = true
newTokens = append(newTokens, to)
LogPush(FailedPush, to, req, result.Error)
if PushConf.Core.Sync {
req.AddLog(getLogPushEntry(FailedPush, to, req, result.Error))