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
Add ability to retry to Client #124
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add an optional argument to the gapi client that will retry failed queries. This is useful as a workaround for the frequent timeouts TinCan is facing that result in an empty query being returned. The hope is that on the next try it will complete the query within the alloted time. Under this hood, this creates a urllib3 `Retry` object in the requests' `HTTPAdapter`. If someone wanted more granular control, it's totally possible to pass other params like backoff_factor to that object.
marz619
requested changes
Apr 15, 2020
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.
@nlipsyc LGTM! Only addition is to add an env variable for max_retries
marz619
approved these changes
Apr 17, 2020
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.
LGTM! 👍
marz619
added a commit
that referenced
this pull request
Apr 20, 2020
* Fix for `2.26.0 (2020-04-14)`_ and `Issue #113`_ * Calls to ``Query.all`` will use initialised its parameters, unless the URI provides its own. * See `PR 123 <https://github.com/gadventures/gapipy/pull/123>`_ * Add the ability to define the ``max_retries`` values on the requestor. * New ``env`` value ``GAPI_CLIENT_MAX_RETRIES`` * The default value will be ``0``, and if provided will override the ``retry`` value on the ``requests.Session``. * This change will also always initialize a ``requests.Session`` value on initialisation of the ``gapipy.Client``. * See `PR 124 <https://github.com/gadventures/gapipy/pull/124>`_ * Add ``variation_id`` field to the ``Image`` resource. * See `Commit edc8d9b <https://github.com/gadventures/gapipy/commit/edc8d9b>`_ * Update the ``ActivityDossier`` and ``AccommodationDOssier`` resources. * Remove the ``is_prepaid`` field * Adds the ``has_costs`` field * See `Commit bd35531 <https://github.com/gadventures/gapipy/commit/bd35531>`_ .. _`Issue #113`: #113
marz619
added a commit
that referenced
this pull request
Apr 20, 2020
* Fix for `2.26.0 (2020-04-14)`_ and `Issue #113`_. * Calls to ``Query.all`` will use initialised its parameters, unless the URI provides its own. * See `PR 123 <https://github.com/gadventures/gapipy/pull/123>`_. * Add the ability to define the ``max_retries`` values on the requestor. * New ``env`` value ``GAPI_CLIENT_MAX_RETRIES``. * The default value will be ``0``, and if provided will override the ``retry`` value on the ``requests.Session``. * This change will also always initialize a ``requests.Session`` value on initialisation of the ``gapipy.Client``. * See `PR 124 <https://github.com/gadventures/gapipy/pull/124>`_. * Add ``variation_id`` field to the ``Image`` resource. * See `Commit edc8d9b <https://github.com/gadventures/gapipy/commit/edc8d9b>`_. * Update the ``ActivityDossier`` and ``AccommodationDOssier`` resources. * Remove the ``is_prepaid`` field. * Adds the ``has_costs`` field. * See `Commit bd35531 <https://github.com/gadventures/gapipy/commit/bd35531>`_. .. _`Issue #113`: #113
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add an optional argument to the gapi client that will retry failed queries. This is useful as a workaround for the frequent timeouts TinCan is facing that result in an empty query being returned. The hope is that on the next try it will complete the query within the alloted time.
Under this hood, this creates a urllib3
Retry
object in the requests'HTTPAdapter
. If someone wanted more granular control, it's totally possible to pass other params like backoff_factor to that object.