Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
clear all open intervals if not needed #16
Conversation
| clearInterval(timerFunction); | ||
| timerFunction = null; | ||
| } | ||
| } | ||
| arrMsg.push(requestBody); | ||
| if (arrMsg.length === arrSize) { | ||
| sendBulkLogs(); |
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.
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.
|
Looks good to me @mchaudhary can review |
@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.