firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.13k stars 242 forks source link

Ability to override default retryconfig #476

Open prashanthjbabu opened 2 years ago

prashanthjbabu commented 2 years ago

I understand that the following PR ( https://github.com/firebase/firebase-admin-go/pull/215/files ) brings in a default retryconfig which allows upto 4 retries . I did notice a comment there where there was some discussion around overriding this default retryconfig . Although it wasnt clearly specified how to go about doing it ( via some example ) . So the question I have is :

  1. Is it possible to override default retryconfig?
  2. If so , how to go about doing this?

CC: @hiranya911

google-oss-bot commented 2 years ago

I found a few problems with this issue:

hiranya911 commented 2 years ago

@prashanthjbabu this is not possible today. RetryConfig is defined as an internal type -- https://github.com/firebase/firebase-admin-go/blob/6b40682756f19c6cf9b327843efaf06a4056a79e/internal/http_client.go#L365-L370

But, it would be useful to make it possible to configure the default retry behavior (may be via an App option or even an environment variable). @lahirumaramba FYA.

sahejsingh commented 2 years ago

Came here to raise a similar request.

Currently the Default retry config checks for just one error (UNAVAILABLE aka 503).

The reason I would need to provide my own retry config is because the library does not handle the retry protocol as suggested by the firebase docs completely.

The firebase docs (https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode) suggest retry should be done for the following error codes:

if the default handler can handle this then users of this library wont need code up their own.

This would be a lot cleaner.

(I believe spanner libraries do the same, handle the retry in the client code)

sheregeda commented 7 months ago

Can you provide me with any updates?

dani3lsf commented 7 months ago

I would also be interested in updates on this topic.