Skip to content

Commit

Permalink
Merge pull request #3533 from SFDO-Tooling/api-throttling
Browse files Browse the repository at this point in the history
Fix incorrect unit
  • Loading branch information
davidmreed authored Sep 22, 2023
2 parents c10eba4 + c8ec070 commit f1c9e13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ def safe_key() -> str:
'rest_framework.throttling.UserRateThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '4/sec',
'user': '4/sec'
'anon': '4/second',
'user': '4/second'
}

}
Expand Down
6 changes: 6 additions & 0 deletions metadeploy/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from functools import reduce
from logging import getLogger
from pathlib import Path
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page

import django_rq
from django.conf import settings
Expand Down Expand Up @@ -157,6 +159,10 @@ class ProductCategoryViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class = ProductCategorySerializer
queryset = ProductCategory.objects.all()

@method_decorator(cache_page(60*60*2))
def list(self, *args, **kwargs):
return super().list(*args, **kwargs) # pragma: nocover


class ProductViewSet(
FilterAllowedByOrgMixin, GetOneMixin, viewsets.ReadOnlyModelViewSet
Expand Down

0 comments on commit f1c9e13

Please sign in to comment.