try catch

This commit is contained in:
Niki Wix Skaarup 2025-04-02 01:58:31 +02:00
parent a04b54ce99
commit a4d5e5d768
Signed by: nikiskaarup
GPG key ID: FC2F1B116F6E788C

View file

@ -9,10 +9,14 @@
// Pooling interval to fetch entries every 31 seconds // Pooling interval to fetch entries every 31 seconds
interval = setInterval(async () => { interval = setInterval(async () => {
const promise = fetchEntries(); try {
// wait for the promise to resolve before assigning to prevent flash const promise = fetchEntries();
await promise; // wait for the promise to resolve before assigning to prevent flash
entriesPromise = promise; await promise;
entriesPromise = promise;
} catch (error) {
console.error('Error fetching entries:', error);
}
}, 1000 * 31); }, 1000 * 31);
return () => clearInterval(interval); return () => clearInterval(interval);