Add frontend loading imporvements
This commit is contained in:
@@ -437,18 +437,21 @@ class SubscriptionLimitService:
|
||||
current_users = len(members)
|
||||
current_locations = 1 # Each tenant has one primary location
|
||||
|
||||
# Get current usage - Products & Inventory
|
||||
current_products = await self._get_ingredient_count(tenant_id)
|
||||
current_recipes = await self._get_recipe_count(tenant_id)
|
||||
current_suppliers = await self._get_supplier_count(tenant_id)
|
||||
# Get current usage - Products & Inventory (parallel calls for performance)
|
||||
import asyncio
|
||||
current_products, current_recipes, current_suppliers = await asyncio.gather(
|
||||
self._get_ingredient_count(tenant_id),
|
||||
self._get_recipe_count(tenant_id),
|
||||
self._get_supplier_count(tenant_id)
|
||||
)
|
||||
|
||||
# Get current usage - IA & Analytics (Redis-based daily quotas)
|
||||
training_jobs_usage = await self._get_training_jobs_today(tenant_id, subscription.plan)
|
||||
forecasts_usage = await self._get_forecasts_today(tenant_id, subscription.plan)
|
||||
|
||||
# Get current usage - API & Storage (Redis-based)
|
||||
api_calls_usage = await self._get_api_calls_this_hour(tenant_id, subscription.plan)
|
||||
storage_usage = await self._get_file_storage_usage_gb(tenant_id, subscription.plan)
|
||||
# Get current usage - IA & Analytics + API & Storage (parallel Redis calls for performance)
|
||||
training_jobs_usage, forecasts_usage, api_calls_usage, storage_usage = await asyncio.gather(
|
||||
self._get_training_jobs_today(tenant_id, subscription.plan),
|
||||
self._get_forecasts_today(tenant_id, subscription.plan),
|
||||
self._get_api_calls_this_hour(tenant_id, subscription.plan),
|
||||
self._get_file_storage_usage_gb(tenant_id, subscription.plan)
|
||||
)
|
||||
|
||||
# Get limits from subscription
|
||||
recipes_limit = await self._get_limit_from_plan(subscription.plan, 'recipes')
|
||||
|
||||
Reference in New Issue
Block a user