仪表盘全局组织统计

pull/6130/head^2
fghbng@qq.com 2021-05-17 15:30:17 +08:00 committed by Jiangjie.Bai
parent 20dacea260
commit c8d7d42f66
2 changed files with 3 additions and 2 deletions

View File

@ -221,8 +221,6 @@ class IndexApi(DatesLoginMetricMixin, APIView):
query_params = self.request.query_params
caches = OrgResourceStatisticsCache(current_org)
if current_org.is_root():
caches.refresh()
_all = query_params.get('all')

View File

@ -18,6 +18,7 @@ def refresh_user_amount_on_user_create_or_delete(user_id):
for org in orgs:
org_cache = OrgResourceStatisticsCache(org)
org_cache.expire('users_amount')
OrgResourceStatisticsCache(Organization.root()).expire('users_amount')
@receiver(post_save, sender=User)
@ -44,6 +45,7 @@ def on_org_user_changed_refresh_cache(sender, action, instance, reverse, pk_set,
for org in orgs:
org_cache = OrgResourceStatisticsCache(org)
org_cache.expire('users_amount')
OrgResourceStatisticsCache(Organization.root()).expire('users_amount')
class OrgResourceStatisticsRefreshUtil:
@ -67,6 +69,7 @@ class OrgResourceStatisticsRefreshUtil:
if cache_field_name:
org_cache = OrgResourceStatisticsCache(instance.org)
org_cache.expire(*cache_field_name)
OrgResourceStatisticsCache(Organization.root()).expire(*cache_field_name)
@receiver(pre_save)