firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.15k stars 249 forks source link

FR : exposing Retry-After header #386

Closed bulletblp4 closed 4 years ago

bulletblp4 commented 4 years ago

As per the documentation, seems like we have to honor the retry after header. But the golang sdk doesn't seem to be exposing it.

hiranya911 commented 4 years ago

SDK automatically does that so no additional handling is necessary. But if you really wish to access the headers, the v4 SDK provides the necessary APIs:

https://pkg.go.dev/firebase.google.com/go/v4/errorutils?tab=doc#HTTPResponse https://firebase.google.com/docs/reference/admin/error-handling#accessing-the-http-response

bulletblp4 commented 4 years ago

Thanks! I havent explored the code base, but as per the docmentations

the SDK will respect that when retrying as long as the specified wait duration is not very long

How long is long here. I am asking cause a while ago we encountered a case where gcm/fcm was down for an hour or more. And our queues were stacked up with thousands of messages. Will SDK handle that case aswell ?

hiranya911 commented 4 years ago

SDK retires are intended to help recover from transient network and backend errors that are short-lived (in the order of seconds). Therefore the SDK does not retry if the backend server sends an error with Retry-After set to a duration longer than 2 minutes.

https://github.com/firebase/firebase-admin-go/blob/cef91acd46f2fc5d0b3408d8154a0005db5bdb0b/internal/http_client.go#L69-L89