-
Couldn't load subscription status.
- Fork 344
fix: Setting a default timeout on all HTTP connections #397
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -775,7 +775,7 @@ def __init__(self, app): | |
| self._auth_override = json.dumps(auth_override, separators=(',', ':')) | ||
| else: | ||
| self._auth_override = None | ||
| self._timeout = app.options.get('httpTimeout') | ||
| self._timeout = app.options.get('httpTimeout', _http_client.DEFAULT_TIMEOUT_SECONDS) | ||
| self._clients = {} | ||
|
|
||
| emulator_host = os.environ.get(_EMULATOR_HOST_ENV_VAR) | ||
|
|
@@ -905,9 +905,8 @@ def __init__(self, credential, base_url, timeout, params=None): | |
| params: Dict of query parameters to add to all outgoing requests. | ||
| """ | ||
| _http_client.JsonHttpClient.__init__( | ||
| self, credential=credential, base_url=base_url, headers={'User-Agent': _USER_AGENT}) | ||
| self.credential = credential | ||
| self.timeout = timeout | ||
| self, credential=credential, base_url=base_url, timeout=timeout, | ||
rsgowman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| headers={'User-Agent': _USER_AGENT}) | ||
| self.params = params if params else {} | ||
|
|
||
| def request(self, method, url, **kwargs): | ||
|
|
@@ -937,8 +936,6 @@ def request(self, method, url, **kwargs): | |
| query = extra_params | ||
| kwargs['params'] = query | ||
|
|
||
| if self.timeout: | ||
| kwargs['timeout'] = self.timeout | ||
| try: | ||
| return super(_Client, self).request(method, url, **kwargs) | ||
| except requests.exceptions.RequestException as error: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a behavioural change. If you want to keep the behaviour the same, we could instead explicitly set a None timeout and defer using the new default of 120s until the next major release of firebase-admin-python. (Although defaulting to an indefinite timeout does seem a little broken, so I'd be happy to call this a bug fix instead.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
google-authshipped the same change as minor version bump. Given our next version is going to be a major version bump this should be ok. And yes, I also prefer to consider this a bug fix than anything else.