Prevent an exception with large num_retries.

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
How about `wait.finite? ? wait + (rand * (wait / 4.0) - (wait / 8.0)) : wait` ?
`finite?` covers `nan` and `inifinity`.