mirror of https://github.com/jumpserver/jumpserver
fix: 升级时清空缓存
parent
7d123ff8c5
commit
21a7ec9fec
|
@ -1,6 +1,7 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from assets.signals_handler.node_assets_mapping import expire_node_assets_mapping_for_memory
|
||||
from orgs.caches import OrgResourceStatisticsCache
|
||||
from orgs.models import Organization
|
||||
|
||||
|
||||
|
@ -12,8 +13,16 @@ def expire_node_assets_mapping():
|
|||
expire_node_assets_mapping_for_memory(org_id)
|
||||
|
||||
|
||||
def expire_org_resource_statistics_cache():
|
||||
orgs = Organization.objects.all()
|
||||
for org in orgs:
|
||||
cache = OrgResourceStatisticsCache(org)
|
||||
cache.expire()
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Expire caches'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
expire_node_assets_mapping()
|
||||
expire_org_resource_statistics_cache()
|
||||
|
|
Loading…
Reference in New Issue