|
10 | 10 | from app_analytics.analytics_db_service import get_total_events_count |
11 | 11 | from app_analytics.influxdb_wrapper import get_current_api_usage |
12 | 12 | from core.helpers import get_current_site_url |
13 | | -from integrations.flagsmith.client import get_client |
| 13 | +from integrations.flagsmith.client import get_openfeature_client |
14 | 14 | from organisations.models import ( |
15 | 15 | Organisation, |
16 | 16 | OrganisationAPIUsageNotification, |
@@ -128,13 +128,13 @@ def handle_api_usage_notification_for_organisation(organisation: Organisation) - |
128 | 128 |
|
129 | 129 | allowed_api_calls = subscription_cache.allowed_30d_api_calls |
130 | 130 |
|
131 | | - flagsmith_client = get_client("local", local_eval=True) |
132 | | - flags = flagsmith_client.get_identity_flags( |
133 | | - organisation.flagsmith_identifier, |
134 | | - traits=organisation.flagsmith_on_flagsmith_api_traits, |
135 | | - ) |
| 131 | + openfeature_client = get_openfeature_client() |
136 | 132 | # TODO: Default to get_total_events_count — https://github.com/Flagsmith/flagsmith/issues/6985 |
137 | | - if flags.is_feature_enabled("get_current_api_usage_deprecated"): # pragma: no cover |
| 133 | + if openfeature_client.get_boolean_value( |
| 134 | + "get_current_api_usage_deprecated", |
| 135 | + default_value=False, |
| 136 | + evaluation_context=organisation.openfeature_evaluation_context, |
| 137 | + ): # pragma: no cover |
138 | 138 | api_usage = get_total_events_count(organisation, period_starts_at) |
139 | 139 | else: |
140 | 140 | api_usage = get_current_api_usage(organisation.id, period_starts_at) |
|
0 commit comments