From 1052dfc1b11734125203567854c39bcae5c61c03 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Thu, 11 Mar 2021 11:01:59 -0700 Subject: [PATCH] Adjust intervals We still fetch voicemails from RingCentral every 60 seconds, but now we check for missing transcriptions every 15 seconds, and poll the database for voicemails that are ready to be ticketized every second. --- src/ticketize.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ticketize.ts b/src/ticketize.ts index 826873f..f7a30bb 100644 --- a/src/ticketize.ts +++ b/src/ticketize.ts @@ -418,22 +418,20 @@ export function ticketize( return [ setAsyncInterval( () => { - const promise = fetchAndStoreNewVoicemails(firstRun); + const promise = fetchAndStoreNewVoicemails(firstRun).catch( + catchHandler + ); firstRun = false; - return promise.catch(catchHandler); + return promise; }, 60 * 1000, true // immediate ), setAsyncInterval( () => fetchMissingTranscriptions().catch(catchHandler), - 60 * 1000, - true - ), - setAsyncInterval( - () => createTickets().catch(catchHandler), - 60 * 1000, + 15 * 1000, true ), + setAsyncInterval(() => createTickets().catch(catchHandler), 1000, true), ]; }