implement SiteUpdates: make the user reload on critical code changes

This commit is contained in:
Laura Klünder 2017-12-24 01:55:30 +01:00
parent 8503b2554c
commit cdfef25034
7 changed files with 84 additions and 11 deletions

View file

@ -418,7 +418,9 @@ class UpdatesViewSet(GenericViewSet):
except ValueError:
cache.set('api_updates_fetch_requests', 0, None)
from c3nav.site.models import SiteUpdate
response = Response({
'last_site_update': SiteUpdate.last_update(),
'last_map_update': MapUpdate.current_processed_cache_key(),
'user': get_user_data(request),
})

View file

@ -163,7 +163,7 @@ class MapUpdate(models.Model):
new_update.save()
transaction.on_commit(
lambda: cache.set('mapdata:last_processed_update', new_updates[-1].to_tuple, 300)
lambda: cache.set('mapdata:last_processed_update', new_updates[-1].to_tuple, None)
)
return new_updates
@ -188,7 +188,7 @@ class MapUpdate(models.Model):
if new:
transaction.on_commit(
lambda: cache.set('mapdata:last_update', self.to_tuple, 300)
lambda: cache.set('mapdata:last_update', self.to_tuple, None)
)
if settings.HAS_CELERY:
transaction.on_commit(