From 1861dd9ced7bf1d4c45eab949d5250280b9883e7 Mon Sep 17 00:00:00 2001 From: Ivan Lee Date: Thu, 1 Sep 2022 08:22:30 -0400 Subject: [PATCH] Small fixes and v5.3.0 prep (#219) * Add request timeout to cache bootstrap from URL. * Only send Slack messages if not a fork (so CI doesn't fail for contributers). * Update README.md. --- .github/workflows/pull_request.yml | 2 +- CHANGELOG.md | 5 +++++ UnleashClient/cache.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ee4816e4..fcf6f8af 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -41,7 +41,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.github_slack_token }} SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook }} - if: always() + if: ${{ github.event.pull_request.head.repo.full_name != 'Unleash/unleash-client-python' }} && (success() || failure()) tox: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 9144c6ce..6ce7ba57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v5.3.0 +* (Minor) Add retries to GET /features. Thanks @janboll! +* (Minor) Add global segments. Thanks @sighphyre! +* (Minor) Documentation updates and tweaks. Thanks @inirudebwoy, @sighphyre, @thomasheartman ! + ## v5.2.0 * (Minor) Add support for bootstrapping UnleashClient with an initial configuration. * (Minor) Add flag to disable toggle polling from server. Thanks @povilasb! diff --git a/UnleashClient/cache.py b/UnleashClient/cache.py index 9a9d565d..3efe700e 100644 --- a/UnleashClient/cache.py +++ b/UnleashClient/cache.py @@ -5,7 +5,7 @@ import requests from fcache.cache import FileCache as _FileCache -from UnleashClient.constants import FEATURES_URL +from UnleashClient.constants import FEATURES_URL, REQUEST_TIMEOUT class BaseCache(abc.ABC): @@ -104,7 +104,7 @@ def bootstrap_from_url(self, initial_config_url: str, headers: Optional[dict] = :param initial_configuration_url: Url that returns document containing initial configuration. Must return JSON. :param headers: Headers to use when GETing the initial configuration URL. """ - response = requests.get(initial_config_url, headers=headers) + response = requests.get(initial_config_url, headers=headers, timeout=REQUEST_TIMEOUT) self.set(FEATURES_URL, response.json()) self.bootstrapped = True