From dccb7512f8560e3ec065e19f8528e9d34d668a0e Mon Sep 17 00:00:00 2001 From: Lynn Smeria Date: Wed, 18 Mar 2020 20:16:36 +0200 Subject: [PATCH] Poll once immediately Otherwise errors will be delayed --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d6eff11..d16bf61 100755 --- a/index.js +++ b/index.js @@ -41,7 +41,7 @@ const convertRecentEventDatesToDelta = () => { }, {}); }; -setInterval(async () => { +const poll = async () => { const { events, seenIds } = await fetchNewEvents(state.seenIds); const hooks = await collectHooks(); const monitoredFolders = new Set(hooks.map(x => x.folder)); @@ -80,4 +80,7 @@ setInterval(async () => { }); state.seenIds = seenIds; -}, 30000); +}; + +setInterval(poll, 30000); +poll();