-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
calc_retry_wait is broken if Integer is used for retry_wait #529
Conversation
👍 |
Hi - sorry abot this - it was due to my PR #502 although it appears my test didn't catch this problem - could you add a test that fails without this change? Also, I believe a similar problem to the one I was trying to solve remains - even though 'wait' will not overflow if it is an Integer, the +/- 12.5% calculation on line 410 converts it to float, which can produce NaN and lead to an exception on 412. So, probably the cleanest fix would be to do the 12.5% retry_wait calculation unconditionally and then check finite? or nan? on the result (which is always a float). |
Converting From mr-salty comment, adding test is best. |
calc_retry_wait is broken if Integer is used for retry_wait
994ac93
to
24ee816
Compare
thanks, it's better.
@mr-salty I can't find the case to produce NaN. Please tell me the case. Anyway, I reverted calc_retry_wait and just convert to Float in configure. Please check it. |
calc_retry_wait is broken if Integer is used for retry_wait
Code seems good so I merged this patch for new release. |
Hi, @sabottenda - sorry i didn't address your comment before merge but it looks ok to me and I also tested it. test_large_num_retries is the one that produces the error, so I added 'retry_wait 1s' to the config there and verified that it fails without your change and passes with it. Thanks for taking care of this! |
Test fails like
|
Maybe, it seems your environment problem. Tests are passed on Travis-CI. |
Ah, got it, passed. Sorry for making worry about this. |
calc_retry_wait is broken if Integer is used for retry_wait
cherry-picked to v0.10 |
From v0.10.58 or later and v0.12, calc_retry_wait causes an exception if Integer is used for retry_wait.
retry_wait is
time
type, so it can be Integer value.#finite?
is a method for Float class, not for Integer.