perf: operate log amount (#9695)

Co-authored-by: feng <1304903146@qq.com>
pull/9698/head
fit2bot 2023-02-22 19:42:40 +08:00 committed by GitHub
parent ddcd09c6a6
commit ec4cdc801f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -147,8 +147,7 @@ class OperateLogViewSet(OrgReadonlyModelViewSet):
return super().get_serializer_class()
def get_queryset(self):
with tmp_to_root_org():
qs = OperateLog.objects.all()
qs = OperateLog.objects.all()
es_config = settings.OPERATE_LOG_ELASTICSEARCH_CONFIG
if es_config:
engine_mod = import_module(TYPE_ENGINE_MAPPING['es'])

View File

@ -101,9 +101,9 @@ class DateTimeMixin:
@lazyproperty
def operate_logs_queryset(self):
from audits.api import OperateLogViewSet
t = self.days_to_datetime
queryset = OperateLog.objects.filter(datetime__gte=t)
queryset = self.get_logs_queryset(queryset, 'user')
queryset = OperateLogViewSet().get_queryset().filter(datetime__gte=t)
return queryset
@lazyproperty