Revert "Retry ADS-B map bootstrap safely"

This reverts commit 02ce4d5bb6.
This commit is contained in:
James Smith
2026-03-19 08:54:59 +00:00
parent 02ce4d5bb6
commit 007a8d50c6

View File

@@ -441,7 +441,6 @@
let mapCrosshairRequestId = 0; let mapCrosshairRequestId = 0;
let detectedDevicesPromise = null; let detectedDevicesPromise = null;
let deviceDetectionRetryTimer = null; let deviceDetectionRetryTimer = null;
let mapBootstrapRetryTimer = null;
let clockInterval = null; let clockInterval = null;
let cleanupInterval = null; let cleanupInterval = null;
let delayedGpsInitTimer = null; let delayedGpsInitTimer = null;
@@ -1736,7 +1735,6 @@ ACARS: ${r.statistics.acarsMessages} messages`;
if (delayedDriverCheckTimer) { clearTimeout(delayedDriverCheckTimer); delayedDriverCheckTimer = null; } if (delayedDriverCheckTimer) { clearTimeout(delayedDriverCheckTimer); delayedDriverCheckTimer = null; }
if (delayedAircraftDbTimer) { clearTimeout(delayedAircraftDbTimer); delayedAircraftDbTimer = null; } if (delayedAircraftDbTimer) { clearTimeout(delayedAircraftDbTimer); delayedAircraftDbTimer = null; }
if (deviceDetectionRetryTimer) { clearTimeout(deviceDetectionRetryTimer); deviceDetectionRetryTimer = null; } if (deviceDetectionRetryTimer) { clearTimeout(deviceDetectionRetryTimer); deviceDetectionRetryTimer = null; }
if (mapBootstrapRetryTimer) { clearTimeout(mapBootstrapRetryTimer); mapBootstrapRetryTimer = null; }
}); });
function ensureAdsbMapBootstrapped() { function ensureAdsbMapBootstrapped() {
@@ -2296,45 +2294,12 @@ sudo make install</code>
const container = document.getElementById('radarMap'); const container = document.getElementById('radarMap');
if (!container || container._leaflet_id) return; if (!container || container._leaflet_id) return;
if (typeof L === 'undefined' || typeof L.map !== 'function') { radarMap = L.map('radarMap', {
if (!mapBootstrapRetryTimer) { center: [observerLocation.lat, observerLocation.lon],
mapBootstrapRetryTimer = setTimeout(() => { zoom: 7,
mapBootstrapRetryTimer = null; minZoom: 3,
ensureAdsbMapBootstrapped(); maxZoom: 15
}, 300); });
}
console.warn('ADS-B: Leaflet not ready yet, retrying map bootstrap');
return;
}
const normalizedLocation = (window.ObserverLocation && typeof ObserverLocation.normalize === 'function')
? ObserverLocation.normalize(observerLocation?.lat, observerLocation?.lon)
: null;
const defaultLocation = {
lat: Number(window.INTERCEPT_DEFAULT_LAT ?? 51.5074),
lon: Number(window.INTERCEPT_DEFAULT_LON ?? -0.1278)
};
const initialLocation = normalizedLocation || defaultLocation;
observerLocation = initialLocation;
try {
radarMap = L.map('radarMap', {
center: [initialLocation.lat, initialLocation.lon],
zoom: 7,
minZoom: 3,
maxZoom: 15
});
} catch (e) {
console.error('ADS-B: L.map() failed:', e);
if (!mapBootstrapRetryTimer) {
mapBootstrapRetryTimer = setTimeout(() => {
mapBootstrapRetryTimer = null;
ensureAdsbMapBootstrapped();
}, 500);
}
return;
}
// Use settings manager for tile layer (allows runtime changes) // Use settings manager for tile layer (allows runtime changes)
window.radarMap = radarMap; window.radarMap = radarMap;