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

@@ -5,7 +5,7 @@ from rest_framework import viewsets
from common.permissions import IsValidUser
from common.exceptions import JMSException
from users.models import User
from orgs.utils import get_org_by_id
from orgs.models import Organization
from .. import serializers
@@ -17,7 +17,7 @@ class AssigneeViewSet(viewsets.ReadOnlyModelViewSet):
def get_org(self):
org_id = self.request.query_params.get('org_id')
org = get_org_by_id(org_id)
org = Organization.get_instance(org_id)
if not org:
error = ('The organization `{}` does not exist'.format(org_id))
raise JMSException(error)