Created
March 13, 2012 21:55
-
-
Save baroquebobcat/2032013 to your computer and use it in GitHub Desktop.
Evil?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Evil Exponential Backoff | |
| # | |
| # fog has this wait_for method that calls #to_f on its interval each iteration | |
| # to determine how to sleep. https://github.com/fog/fog/blob/master/lib/fog/core/wait_for.rb | |
| # | |
| # This object will generate the 2**n series. Each time you call to_f, it'll give you another one. | |
| # | |
| iter = (0..(1/0.0)).each | |
| def iter.to_f | |
| 2**self.next | |
| end | |
| p iter.to_f | |
| # => 1 | |
| p iter.to_f | |
| # => 2 | |
| p iter.to_f | |
| # => 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment