implement SiteUpdates: make the user reload on critical code changes
This commit is contained in:
parent
8503b2554c
commit
cdfef25034
7 changed files with 84 additions and 11 deletions
|
@ -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),
|
||||
})
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue