diff --git a/lib/loggly/common.js b/lib/loggly/common.js index c1d25f9..e5cb2a4 100644 --- a/lib/loggly/common.js +++ b/lib/loggly/common.js @@ -222,8 +222,11 @@ common.loggly = function () { // if (timerFunctionForBufferedLogs === null) { timerFunctionForBufferedLogs = setInterval(function () { - if (arrBufferedMsg.length) sendBufferdLogstoLoggly(); + if (arrBufferedMsg.length) { sendBufferdLogstoLoggly(); } }, bufferOptions.retriesInMilliSeconds); + } else if (timerFunctionForBufferedLogs && !arrBufferedMsg.length) { + clearInterval(timerFunctionForBufferedLogs); + timerFunctionForBufferedLogs = null; }