OSM: Auto-Retry max 3x (30/60/90s), doppelte Tile-Fetches verhindert

Retry-Limit verhindert Endlos-Loop. Delay wächst (30s→60s→90s) damit
mehr Tiles gecacht sein können. Kartenbewegung setzt Counter zurück.
_fetching-Set im Backend verhindert parallele Doppel-Requests pro Tile.
SW by-v407, APP_VER 387
This commit is contained in:
rene 2026-04-25 22:54:12 +02:00
parent 66af669653
commit 6930e6f848
2 changed files with 17 additions and 5 deletions

View file

@ -123,6 +123,7 @@ window.Page_map = (() => {
let _overpassActive = false;
let _ringClosing = false;
let _frankfurtTimer = null;
let _autoRetryCount = 0; // begrenzt Auto-Retry auf max 3x pro Kartenposition
// ----------------------------------------------------------
// INIT
@ -341,7 +342,7 @@ window.Page_map = (() => {
setTimeout(() => _map.invalidateSize(), 600);
window.addEventListener('resize', () => _map.invalidateSize());
_map.on('moveend zoomend', () => { _updateZoomDisplay(); _scheduleOsmLoad(); });
_map.on('moveend zoomend', () => { _autoRetryCount = 0; _updateZoomDisplay(); _scheduleOsmLoad(); });
setTimeout(() => { _updateZoomDisplay(); _scheduleOsmLoad(); }, 800);
// Fadenkreuz-Animation beim Kartenverschieben
@ -703,10 +704,12 @@ window.Page_map = (() => {
_setOsmStatus('Layer deaktiviert — Liste antippen', 100);
}
// Wenn 0 OSM-Marker: Hintergrund-Fetch läuft noch — automatisch nochmal scannen
if (totalLoaded === 0 && zoom >= 14) {
_setOsmStatus('Lade…');
setTimeout(() => { if (!_overpassActive) _scheduleOsmLoad(); }, 20000);
// Wenn 0 OSM-Marker: Hintergrund-Fetch läuft noch — max 3× automatisch nachfragen
if (totalLoaded === 0 && zoom >= 14 && _autoRetryCount < 3) {
_autoRetryCount++;
const delay = _autoRetryCount * 30000; // 30s, 60s, 90s
_setOsmStatus(`Neue Umgebung Daten werden geladen…`);
setTimeout(() => { if (!_overpassActive) _scheduleOsmLoad(); }, delay);
}
}