Using a default HTTP timeout in db module #395
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
google-auth
package now sets a default timeout of 120 seconds for all outgoing requests (see googleapis/google-auth-library-python#435). This is causing a couple of test failures in our codebase: https://github.com/firebase/firebase-admin-python/actions/runs/32412728But more importantly this change leads to unpredictable default behavior in applications that use
firebase_admin
. Specifically, developers who are on older versions ofgoogle-auth
won't get any timeout (timeout=None
), while developers on new versions will get a 2 minutes timeout (timeout=120
).This PR addresses the above discrepancy by setting a default timeout in our own code. This has the following advantages:
firebase_admin
will see consistent behavior regardless of theirgoogle-auth
version.google-auth
.Note that
httpTimeout
option is currently only respected by a subset of our modules. Other modules (e.g. auth), will get their default timeout fromgoogle-auth
for now. I'm using the same default value of 120 seconds to mitigate this, but we should properly address this for all modules in a subsequent PR.