From eb9b2b525e13a76990e8b63c5f64402e47aa7d25 Mon Sep 17 00:00:00 2001 From: Rakhi Mundhada Date: Wed, 3 Jul 2024 13:06:45 +0530 Subject: [PATCH] Updated the poll interval to reduce delay and handle throttle --- collectors/ciscoduo/collector.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/collectors/ciscoduo/collector.js b/collectors/ciscoduo/collector.js index b7485da3..c8157b5b 100644 --- a/collectors/ciscoduo/collector.js +++ b/collectors/ciscoduo/collector.js @@ -122,7 +122,7 @@ class CiscoduoCollector extends PawsCollector { if (error.code && error.code === API_THROTTLING_ERROR) { state.poll_interval_sec = state.poll_interval_sec < MAX_POLL_INTERVAL ? state.poll_interval_sec + POLL_INTERVAL_SECS : MAX_POLL_INTERVAL; - AlLogger.warn(`CDUO000003 API Request Limit Exceeded`, error); + AlLogger.warn(`CDUO000003 API Request Limit Exceeded ${JSON.stringify(error)}`); collector.reportApiThrottling(function () { return callback(null, [], state, state.poll_interval_sec); }); @@ -140,9 +140,9 @@ class CiscoduoCollector extends PawsCollector { if (curState.stream === Authentication) { const untilMoment = moment(parseInt(curState.until)); - // Used hour-cap instead of making api call for 1 min interval, may help to reduce throtling issue. + // As Cisco duo api allows one call per minute, we used an hour cap instead of making API calls for 1-minute intervals. This will help reduce collection delay and throttling. const { nextUntilMoment, nextSinceMoment, nextPollInterval } = calcNextCollectionInterval('hour-cap', untilMoment, this.pollInterval); - const nextPollIntervalSec = nextPollInterval >= POLL_INTERVAL_SECS ? nextPollInterval : POLL_INTERVAL_SECS * JSON.parse(process.env.collector_streams).length; + const nextPollIntervalSec = nextPollInterval >= POLL_INTERVAL_SECS ? nextPollInterval : POLL_INTERVAL_SECS; return { stream: curState.stream, since: nextSinceMoment.valueOf(),