From 747bef3c93bfe3be42e44257508fd4c7da940fa9 Mon Sep 17 00:00:00 2001 From: Sophia Atkinson Date: Tue, 29 Apr 2025 15:08:44 -0700 Subject: [PATCH] fix memory leak --- index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 755ece4..5ed43f7 100644 --- a/index.js +++ b/index.js @@ -132,14 +132,15 @@ async function checkForUpdates(config) { } // Main loop -(async () => { - console.log('🚀 Starting poller...'); +async function poll() { for (const config of configs) { await checkForUpdates(config); } - setInterval(async () => { - for (const config of configs) { - await checkForUpdates(config); - } - }, pollIntervalMs); + setTimeout(poll, pollIntervalMs); +} + + +(async () => { + console.log('🚀 Starting poller...'); + await poll(); })();