-
Notifications
You must be signed in to change notification settings - Fork 17
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
Resolve callback error and modified the entire retry logic #34
Resolve callback error and modified the entire retry logic #34
Conversation
isValidToken = false; | ||
return onError((new Error('Loggly Error (' + responseCode + '): ' + httpStatusCode.badToken.message))); | ||
} | ||
if (responseCode === httpStatusCode.success.code && bulk.attemptNumber >= eventRetried) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mchaudhary This condition checks if the event sent successfully after retrying "n" number of times with status code 200 then print a console message.
isBulk ? sendBulkLogs(mode) : sendInputLogs(mode); | ||
}, sleepTimeMs); | ||
} | ||
if (mode.attemptNumber >= numberOfRetries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mchaudhary This condition checks if the total number of retries has reached the maximum retrying limit then show the failed event message on console.
isValidToken = false; | ||
return onError((new Error('Loggly Error (' + responseCode + '): ' + httpStatusCode.badToken.message))); | ||
} | ||
if (responseCode === httpStatusCode.success.code && input.attemptNumber >= eventRetried) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mchaudhary This condition checks if the event sent successfully after retrying "n" number of times with status code 200 then print a console message.
sendInputLogs(input); | ||
} | ||
} | ||
function createBulk(msgs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mchaudhary In this function, I am attaching some fields with the event like attempt number, eventId and time to retry in so that later the library can identify which event was failed on which error and in what time this event needs to retry.
fbae04d
to
b92b702
Compare
Any ETA when this will be merged ? We have error |
Same here, we'd love to see this merged! |
Hey everyone, we apologize for the delay in processing this PR. I'm working right now on making sure it's brought to the right people's attention to be fixed ASAP. |
@mchaudhary Will there be a patch version bump to release this change? The current version 2.2.1 was updated 3 months ago. Thanks. |
@mchaudhary @mostlyjason In this PR, I have modified the entire error retry logic and have covered the below points:
Also, I took a reference of retry logic from here: https://github.com/logzio/logzio-nodejs/blob/master/lib/logzio-nodejs.js#L248-L258.
I checked the library behavior after these changes in a continue logging environment for about 8 hours and did not see any callback error. The issue is related to loggly/winston-loggly-bulk#13.
Update: I also tested the library code in both bulk & input mode for 15 days in a continue event logging environment. My node application did not break with any error.
Please review the changes.