Fix: Realtime-Subscription deaktiviert (NPM SSE-Problem), Polling alle 15s
This commit is contained in:
parent
27ad75b735
commit
8559d2831e
1 changed files with 3 additions and 14 deletions
|
|
@ -110,20 +110,9 @@
|
||||||
if (!browser) return;
|
if (!browser) return;
|
||||||
fetchLiveData();
|
fetchLiveData();
|
||||||
|
|
||||||
// Realtime: sofort aktualisieren wenn neuer Eintrag gespeichert wird
|
// Polling alle 15s
|
||||||
pb.collection('check_logs').subscribe('*', (e) => {
|
const iv = setInterval(fetchLiveData, 15_000);
|
||||||
if (e.action === 'create' && e.record?.tenant === DEMO_TENANT) {
|
return () => clearInterval(iv);
|
||||||
fetchLiveData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Fallback-Polling alle 30s
|
|
||||||
const iv = setInterval(fetchLiveData, 30_000);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
pb.collection('check_logs').unsubscribe('*');
|
|
||||||
clearInterval(iv);
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function formatTime(iso: string) {
|
function formatTime(iso: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue