mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Handle transient network suspension in frontend polling and SSE
This commit is contained in:
@@ -5655,10 +5655,19 @@
|
||||
renderSdrStatus(devices);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Failed to fetch SDR status:', err);
|
||||
const transient = (typeof window.isTransientOrOffline === 'function' && window.isTransientOrOffline(err)) ||
|
||||
(typeof navigator !== 'undefined' && navigator.onLine === false) ||
|
||||
/failed to fetch|network io suspended|networkerror|timeout/i.test(String((err && err.message) || err || ''));
|
||||
if (!transient) {
|
||||
console.error('Failed to fetch SDR status:', err);
|
||||
}
|
||||
const container = document.getElementById('sdrStatusList');
|
||||
if (container) {
|
||||
container.innerHTML = '<div style="padding: 8px; color: #ff6666; font-size: 11px; text-align: center;">Error loading status</div>';
|
||||
if (transient) {
|
||||
container.innerHTML = '<div style="padding: 8px; color: #888; font-size: 11px; text-align: center;">Status temporarily unavailable</div>';
|
||||
} else {
|
||||
container.innerHTML = '<div style="padding: 8px; color: #ff6666; font-size: 11px; text-align: center;">Error loading status</div>';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -971,7 +971,12 @@
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Position update error:', err);
|
||||
const transient = (typeof window.isTransientOrOffline === 'function' && window.isTransientOrOffline(err)) ||
|
||||
(typeof navigator !== 'undefined' && navigator.onLine === false) ||
|
||||
/failed to fetch|network io suspended|networkerror|timeout/i.test(String((err && err.message) || err || ''));
|
||||
if (!transient) {
|
||||
console.error('Position update error:', err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user