Skip to content

Commit

Permalink
Merge pull request #51 from hellohaptik/saumilhaptik-patch-2
Browse files Browse the repository at this point in the history
Update __init__.py
  • Loading branch information
saumilhaptik authored Sep 20, 2024
2 parents 818190e + e3ff6e8 commit 2ba4d95
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions FeatureToggle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def update_cache(data: Dict[str, Any]) -> None:
'To update cache Feature Toggles class needs to be initialised'
)

LOGGER.info(f'Updating the cache data: {data}')
try:
FeatureToggles.__cache.set(
consts.FEATURES_URL, pickle.dumps(data)
Expand All @@ -119,7 +118,6 @@ def update_cache(data: Dict[str, Any]) -> None:
error_msg = f'Unknown Exception occurred while updating the redis cache: {str(err)}'
LOGGER.info(error_msg)
raise Exception(error_msg)
LOGGER.info(f'[Feature Toggles] Cache Updated')

@staticmethod
def __get_unleash_client():
Expand Down Expand Up @@ -180,8 +178,6 @@ 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: "
f"{FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return domain_name in feature_toggles.get(feature_name, {}).get('domain_names', [])

@staticmethod
Expand All @@ -196,8 +192,6 @@ 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: "
f"{FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return partner_name in feature_toggles.get(feature_name, {}).get('partner_names', [])

@staticmethod
Expand All @@ -212,8 +206,6 @@ 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: "
f"{FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return business_via_name in feature_toggles.get(feature_name, {}).get('business_via_names', [])

@staticmethod
Expand All @@ -228,8 +220,6 @@ 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: "
f"{FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return expert_email in feature_toggles.get(feature_name, {}).get('expert_emails', [])

@staticmethod
Expand All @@ -244,8 +234,6 @@ 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: "
f"{FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
return team_id in feature_toggles.get(feature_name, {}).get('team_ids', [])

@staticmethod
Expand All @@ -264,9 +252,6 @@ def fetch_feature_toggles():
"""
# TODO: Remove the cas and environment name from the feature toggles while returning the response
response = {}
LOGGER.info(f'Loading Feature Toggles from Redis')
LOGGER.info(f"Fetch_feature_toggles_cache_info:"
f"{FeatureToggles.fetch_feature_toggles.__wrapped__.cache_info()}")
if FeatureToggles.__cache is None:
LOGGER.error('To update cache Feature Toggles class needs to be initialised')
return response
Expand Down

0 comments on commit 2ba4d95

Please sign in to comment.