Commit 04342d5d authored by Peter Palfrader's avatar Peter Palfrader

Try to get a connection for a while before we fail

parent 9ec466de
......@@ -22,12 +22,21 @@
import psycopg2.extras
import time
import sys
class DBInstance:
MAX_ERR = 10
MAX_RETRY_OPEN = 20
def __init__(self, pool):
self.pool = pool
delay = 0.0
for i in xrange(0, self.MAX_RETRY_OPEN):
try:
self.conn = pool.getconn()
return
except psycopg2.PoolError:
delay += 0.1
self.conn = pool.getconn()
def _reopen(self, delay=0.0):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment