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

Prevent an exception with large num_retries. #502

Merged
merged 2 commits into from
Dec 10, 2014

Conversation

mr-salty
Copy link
Contributor

@mr-salty mr-salty commented Dec 8, 2014

If the calculated wait time is infinite, don't try to do
further calculations on it to prevent it from becoming NaN.
This could happen if num_retries becomes too large (>1024).

Fixes issue #501

If the calculated wait time is infinite, don't try to do
further calculations on it to prevent it from becoming NaN.
This could happen if num_retries becomes too large (>1024).
@repeatedly repeatedly added the bug Something isn't working label Dec 9, 2014
@repeatedly repeatedly self-assigned this Dec 9, 2014
@@ -401,7 +401,7 @@ def calc_retry_wait
# secondary retry
@retry_wait * (2 ** (@num_errors - 2 - @retry_limit))
end
retry_wait = wait + (rand * (wait / 4.0) - (wait / 8.0))
retry_wait = wait.infinite? ? wait : wait + (rand * (wait / 4.0) - (wait / 8.0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about wait.finite? ? wait + (rand * (wait / 4.0) - (wait / 8.0)) : wait ?
finite? covers nan and infinity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

repeatedly added a commit that referenced this pull request Dec 10, 2014
Prevent an exception with large num_retries.
@repeatedly repeatedly merged commit 3fbba4a into fluent:master Dec 10, 2014
@repeatedly
Copy link
Member

Good catch!

repeatedly added a commit that referenced this pull request Dec 10, 2014
Prevent an exception with large num_retries.
@sonots
Copy link
Member

sonots commented Dec 10, 2014

cherry-picked to v0.10 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants