Beispiel #1
0
 def test_exponential_backoff_with_jitter(self):
     backoff = standard.ExponentialBackoff()
     backoffs = [
         backoff.delay_amount(standard.RetryContext(attempt_number=3))
         for i in range(10)
     ]
     # For attempt number 3, we should have a max value of 4 (2 ^ 2),
     # so we can assert all the backoff values are within that range.
     for x in backoffs:
         self.assertTrue(0 <= x <= 4)
Beispiel #2
0
 def setUp(self):
     self.random = lambda: 1
     self.backoff = standard.ExponentialBackoff(max_backoff=20,
                                                random=self.random)