Skip to content
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

No verbose output to log in case of retries #98

Open
advance512 opened this issue May 13, 2020 · 0 comments
Open

No verbose output to log in case of retries #98

advance512 opened this issue May 13, 2020 · 0 comments

Comments

@advance512
Copy link
Contributor

When using the base client (we extended it for the Hubspot Associations API), we see the following in our logs:

2020-05-13 23:09:51,608 [22/#7f68ac2b2ae0] WARNING in base._call_raw:323: Too many retries for /crm-associations/v1/associations/123456/HUBSPOT_DEFINED/1?
2020-05-13 23:09:52,662 [22/#7f68ac2b2ae0] WARNING in base._call_raw:323: Too many retries for /crm-associations/v1/associations/123456/HUBSPOT_DEFINED/1?
2020-05-13 23:09:53,722 [22/#7f68ac2b2ae0] WARNING in base._call_raw:323: Too many retries for /crm-associations/v1/associations/123456/HUBSPOT_DEFINED/1?

Further in the logs, there no log output of any kind explaining what issue was encountered, what HTTP status code was returned, what error was encountered. No exception is thrown, and eventually (after 2-3 tries) the function using the BaseClient just returns None.

Looking at the code:

            except HubspotError as exception:
                if try_count > num_retries:
                    logging.warning("Too many retries for {}".format(url))
                    raise
                # Don't retry errors from 300 to 499
                if (
                    exception.result
                    and exception.result.status >= 300
                    and exception.result.status < 500
                ):
                    raise
                self._prepare_request_retry(method, url, headers, data)
                self.log.warning(
                    "HubspotError {} calling {}, retrying".format(
                        exception, url
                    )
                )
            # exponential back off - wait 0 seconds, 1 second, 3 seconds, 7 seconds, 15 seconds, etc
            time.sleep((pow(2, try_count - 1) - 1) * self.sleep_multiplier)

it seems like an exception should have indeed been thrown, so I am not certain why I don't see it outside. Anyways, I see the self.log.warning() call and I wonder why this output is not written to the log.

Is there any way to configure hubspot3 to print this warning to log in case of an error causing a retry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant