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

Added gitignore and added retries for failed batch attempts #43

Open
wants to merge 8 commits into
base: master
from

Fixed issue with setTimeout

  • Loading branch information
Clark, Jason Clark, Jason
Clark, Jason authored and Clark, Jason committed Aug 3, 2016
commit 24a3ba454fa6e299220a582c83a42c149f61d463

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -151,6 +151,8 @@
// inject session id
data.sessionId = this.session_id;

var self = this;

//track number of attempts to publish
var attemptCounter = 0;
if(attempts) {
@@ -171,16 +173,19 @@
console.log("Failed to log to loggly because of a network condition.");
console.log("Will attempt to log again in 5 seconds.");

postTimeout = setTimeout(this.track(data, attemptCounter + 1), 5000);
postTimeout = setTimeout(function() {
self.track(data, attemptCounter + 1)
}, 5000);
} else {
console.log("Loggly has attempted to log this data for the last minute and failed. Ceasing" +
" attempts to log.");
console.log("Failed log data:", data);

clearTimeout(postTimeout);
}
} else if (xmlHttp.status === 200) {
} else if (xmlHttp.status === 200 || xmlHttp.status === 304) {
if(postTimeout) {
console.log("Successfully logged to loggly.");
clearTimeout(postTimeout);
attemptCounter = 0;
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.