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

isBulk doesn't disable setInterval #42

Open
rizowski opened this issue Dec 7, 2018 · 1 comment
Open

isBulk doesn't disable setInterval #42

rizowski opened this issue Dec 7, 2018 · 1 comment

Comments

@rizowski
Copy link

rizowski commented Dec 7, 2018

Issue

I've been trying to get node-loggly-bulk running on AWS lambda and have been running into timeout issues. One inconsistency I ran into was passing in the isBulk property and expecting it to not do any sort of polling.

Culprit lines:

https://github.com/loggly/node-loggly-bulk/blob/master/lib/loggly/client.js#L79
https://github.com/loggly/node-loggly-bulk/blob/master/lib/loggly/common.js#L317

Proposed Solutions

I think we could change client.js#L79 to something like this

this.isBulk = options.isBulk || false;

 var defaultBufferOptions = this.isBulk
    ? { size: 500, retriesInMilliSeconds: 30 * 1000 }
    : { size: 1, retriesInMilliSeconds: 100 };

this.bufferOptions = options.bufferOptions || defaultBufferOptions

Another solution I could see, but don't completely know the implications of the change, would be to change common.js#317 to:

if (timerFunctionForBufferedLogs === null && isBulk) {
    timerFunctionForBufferedLogs = setInterval(function() {
      ...   
    }, bufferOptions.retriesInMilliSeconds);
  }
@whtswrng
Copy link

Thank you for reporting this issue. We are now tracking this issue internally as LOG-12016.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants