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

Update __init__.py #51

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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