perf: Add configurable throttle rates for anonymous user and service accounts

This commit is contained in:
wangruidong
2026-01-14 16:47:51 +08:00
committed by 老广
parent 1b759e7820
commit f77aa080b1
2 changed files with 7 additions and 3 deletions

View File

@@ -221,6 +221,10 @@ class Config(dict):
'ANNOUNCEMENT_ENABLED': True,
'ANNOUNCEMENT': {},
'THROTTLE_RATES_ANON': '60/min',
'THROTTLE_RATES_USER': '180/min',
'THROTTLE_RATES_SERVICE_ACCOUNT': '300/min',
# Security
'X_FRAME_OPTIONS': 'SAMEORIGIN',

View File

@@ -42,9 +42,9 @@ REST_FRAMEWORK = {
'common.drf.throttling.RateThrottle',
),
'DEFAULT_THROTTLE_RATES': {
'anon': '60/min',
'user': '180/min',
'service_account': '300/min',
'anon': CONFIG.THROTTLE_RATES_ANON,
'user': CONFIG.THROTTLE_RATES_USER,
'service_account': CONFIG.THROTTLE_RATES_SERVICE_ACCOUNT,
},
'DEFAULT_FILTER_BACKENDS': (
'django_filters.rest_framework.DjangoFilterBackend',