Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear all open intervals if not needed #16

Merged
merged 1 commit into from Sep 12, 2017

Conversation

@Shwetajain148
Copy link

@Shwetajain148 Shwetajain148 commented Aug 25, 2017

@mchaudhary @mostlyjason In this PR, I have used clearIntervals() function to clear all open intervals. I have tested the library code and observed that clearInterval will clear the open intervals each time after sending logs but if continue logging is taking place then it is required to keep the interval open otherwise sendBulkLogs() and sendBufferdLogstoLoggly() functions will not call and logging will not happen.

So in that way, even after implementing clearInterval function if we check for open handlers using wtf-node package in our library then it may possible that those existing open handlers will be there to keep the logging continue.

Related to loggly/winston-loggly-bulk#12

Please review.

clearInterval(timerFunction);
timerFunction = null;
}
}
arrMsg.push(requestBody);
if (arrMsg.length === arrSize) {
sendBulkLogs();

This comment has been minimized.

@Shwetajain148

Shwetajain148 Aug 30, 2017
Author

At line #217, sendBulkLogs() function is called inside the if (arrMsg.length === arrSize) condition which basically checks if the arrMsg(an array in which logs get pushed) array's length is equal to arrSize which is 100 then send the all logs instantly without waiting.
And at line #208, sendBulkLogs() function is called inside the setInterval function to keep calling the same function in every 5 seconds.
This is the behaviour of the library since the bulk mode was implemented.

@mostlyjason
Copy link

@mostlyjason mostlyjason commented Sep 5, 2017

Looks good to me @mchaudhary can review

@mchaudhary mchaudhary merged commit 85d62db into loggly:master Sep 12, 2017
@Shwetajain148 Shwetajain148 deleted the Shwetajain148:Clear-all-open-intervals branch Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.