logdna / nodejs

Node.js library for logging to LogDNA
MIT License
74 stars 66 forks source link

Flush automatically after Backoff timer #91

Closed meganwalker-ibm closed 4 years ago

meganwalker-ibm commented 4 years ago

On a quiet microservice log lines can be held in buffer for hours or days after a temporary network problem is restored. This can interfere greatly when trying to diagnose an application problem through logs that are expected to be in LogDNA, but are instead buffered waiting to be sent.

This PR changes the behaviour to use a setTimeout for backoff interval when a flush has failed, rather than on the submission of a new message to the buffer. This allows the flush to happen reasonably quickly after a network problem has resolved.

In addition we fix the loading of the retryTimeout option into this._ retryTimeout.

In addition to adding new tests to cover this, there's also some test cleanup that we found helped us to understand the flow of the HTTP Exception test cases - the use of two separate flags edgeCaseFlag and countHits for what were only ever used to do the job of a boolean, for example.

meganwalker-ibm commented 4 years ago

Ok, thankyou. I await your PR :)

vilyapilya commented 4 years ago

@meganwalker-ibm we have released v3.5.0 with the mentioned changes. Please let us know if you have any concerns or feedback. Thank you again for using our product and your feedback!