fix var name for backoff retry - #155
Conversation
Mr0grog
left a comment
There was a problem hiding this comment.
This is simple enough that it’s pretty clear what’s going on, but in the future, please include a basic reproduction or and/or a clearer description of how you’d actually trigger the error you’re describing! The PR description was a little confusing at first.
I think the test needs a slight tweak (see inline comment), but otherwise this is great. Thanks for submitting a fix. 👍🏻
| await reporter.report([mockMetric]).should.be.fulfilled; | ||
|
|
||
| const timeDelta = callTimes[1] - callTimes[0]; | ||
| timeDelta.should.be.at.least(MIN_RETRY_DELAY_MS); |
There was a problem hiding this comment.
Like the other tests here that cover retry delays, this should really be using .within() to test both a lower and upper bound. Otherwise this test would pass in the opposite situation if we accidentally wound up using a delay that was too big.
I also think it might be worth using a separate reporter instance for this one test so you can set a bigger backoff. The jitter you are accounting for here is a big percentage of the whole backoff time, which makes the test feel somewhat inaccurate. Also, the jitter accounted for needs to be bigger — I’ve already seen this fail locally for me once when running it.
I don’t think the backoff needs to be a whole second like it is in the next test, but it should probably at least be something like 100ms instead of 10.
There was a problem hiding this comment.
On average it takes about 112ms for the test to run for me. At it's longest I observed 118ms. Happy to adjust the upper and lower bounds more if other environment produce a larger spread.
Glad this got merged - Any chance you guys could publish a patch release for this? |
Fix to address mismatch in variables names for reporters.js backoff value
Problem:
Original error:
`
(node:1) TimeoutNaNWarning: NaN is not a number.
Timeout duration was set to 1.