Skip to content

Commit

Permalink
perf: 支持配置文件配置限制的最大数量
Browse files Browse the repository at this point in the history
  • Loading branch information
feng626 authored and BaiJiangJie committed Mar 6, 2024
1 parent 5157514 commit a7a099f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/common/drf/renders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import datetime

import pyzipper
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from rest_framework.renderers import BaseRenderer
Expand Down Expand Up @@ -77,7 +78,7 @@ def process_data(self, data):
results = [results[0]] if results else results
else:
# 限制数据数量
results = results[:10000]
results = results[:settings.MAX_LIMIT_PER_PAGE]
# 会将一些 UUID 字段转化为 string
results = json.loads(json.dumps(results, cls=encoders.JSONEncoder))
return results
Expand Down

0 comments on commit a7a099f

Please sign in to comment.