Force cache clearing when a new point is added, fix #522

This commit is contained in:
Pieter Vander Vennet 2021-10-25 21:08:44 +02:00
parent 936cf1bf9f
commit d1ecaf7527
3 changed files with 32 additions and 7 deletions

View file

@ -91,14 +91,22 @@ export default class FeaturePipeline {
const self = this
const expiryInSeconds = Math.min(...state.layoutToUse.layers.map(l => l.maxAgeOfCache))
this.oldestAllowedDate = new Date(new Date().getTime() - expiryInSeconds);
for (const layer of state.layoutToUse.layers) {
TiledFromLocalStorageSource.cleanCacheForLayer(layer)
}
this.oldestAllowedDate = new Date(new Date().getTime() - expiryInSeconds);
this.osmSourceZoomLevel = state.osmApiTileSize.data;
// milliseconds
const useOsmApi = state.locationControl.map(l => l.zoom > (state.overpassMaxZoom.data ?? 12))
this.relationTracker = new RelationsTracker()
state.changes.allChanges.addCallbackAndRun(allChanges => {
allChanges.filter(ch => ch.id < 0)
.map(ch => ch.changes)
.filter(coor => coor["lat"] !== undefined && coor["lon"] !== undefined)
.forEach(coor => {
SaveTileToLocalStorageActor.poison(state.layoutToUse.layers.map(l => l.id), coor["lon"], coor["lat"])
})
})
this.sufficientlyZoomed = state.locationControl.map(location => {