fix mapupdate caching
@@ -40,7 +40,7 @@ class MapUpdate(models.Model):
with cls.lock():
last_update = cls.objects.latest()
result = last_update.to_tuple
- cache.set('mapdata:last_update', result, 60)
+ cache.set('mapdata:last_update', result, 300)
return result
@classmethod
@@ -51,7 +51,7 @@ class MapUpdate(models.Model):
with cls.lock():
last_processed_update = cls.objects.filter(processed=True).latest()
result = last_processed_update.to_tuple
- cache.set('mapdata:last_processed_update', result, 60)
+ cache.set('mapdata:last_processed_update', result, 300)
return result
@property
@@ -131,7 +131,7 @@ class MapUpdate(models.Model):
Router.rebuild()
transaction.on_commit(
- lambda: cache.delete('mapdata:last_processed_update')
+ lambda: cache.set('mapdata:last_processed_updatee', new_updates[-1].totuple, 300)
)
return new_updates
@@ -151,7 +151,7 @@ class MapUpdate(models.Model):
if new:
transaction.on_commit(
- lambda: cache.delete('mapdata:last_update')
+ lambda: cache.set('mapdata:last_update', self.to_tuple, 300)
)
if settings.HAS_CELERY:
transaction.on_commit(
