Cut off the timeout increases after 5 failures by default

Contrary to popular beliefs there are Python processes in the wild that
run for weeks and increasing the timeout without bound is not useful for
those.
This commit is contained in:
Honza Kral
2013-06-14 16:59:36 +02:00
parent da478caf12
commit 30bbb2a0cd
2 changed files with 17 additions and 3 deletions
@@ -74,6 +74,15 @@ class TestConnectionPool(TestCase):
self.assertEquals(3, pool.dead_count[42])
self.assertEquals((now + 4*60, 42), pool.dead.get())
def test_timeout_for_failed_connections_is_limitted(self):
pool = ConnectionPool([(x, {}) for x in range(100)])
now = time.time()
pool.dead_count[42] = 245
pool.mark_dead(42, now=now)
self.assertEquals(246, pool.dead_count[42])
self.assertEquals((now + 32*60, 42), pool.dead.get())
def test_dead_count_is_wiped_clean_for_connection_if_marked_live(self):
pool = ConnectionPool([(x, {}) for x in range(100)])
now = time.time()