Reconnect in db_exec on network error for issue1387

(transplanted from 5b24e83a0266dc4cf703947f15865c9b69df6c32)
This commit is contained in:
Cédric Krier committed 2010-03-18 15:29:16 +01:00
1 parent 1a5a650826
commit 50eea15ee0
1 file changed
+8 -1
+8 -1
View File
@@ -60,7 +60,14 @@ def db_exec(host, port, method, *args):
_SOCK.connect(host, port)
args = (None, None, None, 'common', 'db', method) + args
logging.getLogger('rpc.request').info(repr(args))
_SOCK.send(args)
try:
_SOCK.send(args)
except Exception, exception:
if exception[0] == 32:
_SOCK.reconnect()
_SOCK.send(args)
else:
raise
res = _SOCK.receive()
SECURE = _SOCK.ssl
finally: