From 83e5ed7eb3f6eb7c36a920f66943e083b8ed2d23 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 20 Aug 2024 11:26:08 -0600 Subject: [PATCH] Reduce block polling interval --- src/main.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 00fde005..f30afb23 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,7 +19,11 @@ app.use(LazyLoad, { component: true }); // Mount vue app app.mount('#app'); -const REFRESH_INTERVAL = import.meta.env.VITE_REFRESH_INTERVAL || 6000; // 6 seconds +// fetch new block(s) on this interval, specified in miliseconds +// note that the design of the block fetching code is such that it +// will MISS BLOCKS if this interval is longer than the block time +// TODO: make this configurable +const blockFetchInterval = 2 * 1000; // fetch latest block every 6s const blockStore = useBaseStore(); @@ -30,4 +34,4 @@ setInterval(() => { // max allowed request blockStore.fetchLatest().finally(() => (requestCounter.value -= 1)); } -}, REFRESH_INTERVAL); +}, blockFetchInterval);