Skip to content

Commit

Permalink
Merge pull request #40 from hellohaptik/develop
Browse files Browse the repository at this point in the history
Develop-> master release
  • Loading branch information
mukesh-haptik authored Jun 7, 2022
2 parents b20b1ed + b8bc556 commit 1539b69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions FeatureToggle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def is_enabled_for_domain(feature_name: str,
(bool): True if Feature is enabled else False
"""
feature_toggles = FeatureToggles.fetch_feature_toggles()
LOGGER.info(f"Enable_for_domain_FT_cache_info: {FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return domain_name in feature_toggles.get(feature_name, {}).get('domain_names', [])

@staticmethod
Expand All @@ -162,6 +163,7 @@ def is_enabled_for_partner(feature_name: str,
(bool): True if Feature is enabled else False
"""
feature_toggles = FeatureToggles.fetch_feature_toggles()
LOGGER.info(f"Enable_for_partner_FT_cache_info: {FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return partner_name in feature_toggles.get(feature_name, {}).get('partner_names', [])

@staticmethod
Expand All @@ -176,6 +178,7 @@ def is_enabled_for_business(feature_name: str,
(bool): True if Feature is enabled else False
"""
feature_toggles = FeatureToggles.fetch_feature_toggles()
LOGGER.info(f"Enable_for_business_FT_cache_info: {FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return business_via_name in feature_toggles.get(feature_name, {}).get('business_via_names', [])

@staticmethod
Expand All @@ -190,6 +193,7 @@ def is_enabled_for_expert(feature_name: str,
(bool): True if Feature is enabled else False
"""
feature_toggles = FeatureToggles.fetch_feature_toggles()
LOGGER.info(f"Enable_for_expert_FT_cache_info: {FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return expert_email in feature_toggles.get(feature_name, {}).get('expert_emails', [])

@staticmethod
Expand All @@ -204,6 +208,7 @@ def is_enabled_for_team(feature_name: str,
(bool): True if feature is enabled else False
"""
feature_toggles = FeatureToggles.fetch_feature_toggles()
LOGGER.info(f"Enable_for_team_FT_cache_info: {FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return team_id in feature_toggles.get(feature_name, {}).get('team_ids', [])

@staticmethod
Expand All @@ -222,6 +227,7 @@ def fetch_feature_toggles():
"""
# TODO: Remove the cas and environment name from the feature toggles while returning the response
LOGGER.info(f'Loading Feature Toggles from Redis')
LOGGER.info(f"Efetch_feature_toggles_cache_info: {FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
if FeatureToggles.__cache is None:
raise Exception(
'To update cache Feature Toggles class needs to be initialised'
Expand Down
2 changes: 1 addition & 1 deletion FeatureToggle/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from UnleashClient import LOGGER
from UnleashClient.utils import LOGGER
from datetime import datetime, timedelta
from functools import lru_cache, wraps

Expand Down
2 changes: 1 addition & 1 deletion UnleashClient/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import mmh3 # pylint: disable=import-error
from requests import Response

LOGGER = logging.getLogger(__name__)
LOGGER = logging.getLogger("mogambo")


def normalized_hash(identifier: str,
Expand Down

0 comments on commit 1539b69

Please sign in to comment.