fix mapdata updates fetch counter

This commit is contained in:
Laura Klünder 2017-12-24 21:16:23 +01:00
parent e237b26464
commit e58e26ba76

View file

@ -415,11 +415,6 @@ class UpdatesViewSet(GenericViewSet):
"""
@list_route(methods=['get'])
def fetch(self, request, key=None):
try:
cache.incr('api_updates_fetch_requests')
except ValueError:
cache.set('api_updates_fetch_requests', 0, None)
cross_origin = request.META.get('HTTP_ORIGIN')
if cross_origin is not None:
try:
@ -428,6 +423,12 @@ class UpdatesViewSet(GenericViewSet):
except ValueError:
pass
counter_key = 'api_updates_fetch_requests%s' % ('_cross_origin' if cross_origin is not None else '')
try:
cache.incr(counter_key)
except ValueError:
cache.set(counter_key, 0, None)
from c3nav.site.models import SiteUpdate
result = {