perf: 优化org获取逻辑 - 采用redis订阅机制实现orgs_mapping数据的维护;删除get_org_by_id等方法;

perf: 优化get_instance接口
This commit is contained in:
Bai
2021-03-03 11:20:40 +08:00
committed by Jiangjie.Bai
parent e6b17da57d
commit 1d15f7125e
9 changed files with 113 additions and 118 deletions

View File

@@ -7,8 +7,7 @@ from django.core.exceptions import ValidationError
from common.utils import get_logger
from ..utils import (
set_current_org, get_current_org, current_org,
filter_org_queryset, get_org_by_id, get_org_name_by_id
set_current_org, get_current_org, current_org, filter_org_queryset
)
from ..models import Organization
@@ -59,11 +58,11 @@ class OrgModelMixin(models.Model):
@property
def org(self):
return get_org_by_id(self.org_id)
return Organization.get_instance(self.org_id)
@property
def org_name(self):
return get_org_name_by_id(self.org_id)
return self.org.name
@property
def fullname(self, attr=None):