Skip to content

Commit

Permalink
Update throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
eheinrich committed Jun 22, 2019
1 parent c09a16c commit 9c3cc67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion observation_portal/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def api_quota(self):
hours as well as the maximum allowed by DRF's throttling framework'''
hits = cache.get('throttle_user_{0}'.format(self.user.id))
used = len(hits) if hits else 0
allowed = settings.REST_FRAMEWORK['DEFAULT_THROTTLE_RATES']['user']
allowed = 'unlimited' # placeholder in case we ever reimplement a stricter throttle policy
return {'used': used, 'allowed': allowed}

def __str__(self):
Expand Down
8 changes: 3 additions & 5 deletions observation_portal/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,12 @@
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 10,
'DEFAULT_THROTTLE_CLASSES': (
'observation_portal.accounts.throttling.AllowStaffUserRateThrottle',
'rest_framework.throttling.ScopedRateThrottle',
),
'DEFAULT_THROTTLE_RATES': {
'user': '5000/day',
'requestgroups.cancel': '1000/day',
'requestgroups.create': '2500/day',
'requestgroups.validate': '10000/day'
'requestgroups.cancel': '2000/day',
'requestgroups.create': '5000/day',
'requestgroups.validate': '20000/day'
}
}

Expand Down

0 comments on commit 9c3cc67

Please sign in to comment.