Commit 907ea7c9 authored by Gero Müller's avatar Gero Müller
Browse files

add 60 sec request timeout

parent 6ee2872f
......@@ -201,6 +201,8 @@ class WrappedChannelFile(object):
class RpycConnection(rpyc.Connection):
REQUEST_TIMEOUT = 60
def _send_request(self, seq, handler, args):
self._send(rpyc.core.consts.MSG_REQUEST, seq, (handler, self._box(args)))
return seq
......@@ -223,8 +225,12 @@ class RpycConnection(rpyc.Connection):
"""
seq = next(self._seqcounter)
self._send_request(seq, handler, args)
start = time.time()
while seq not in self._sync_replies:
self.serve(0.1)
if (start + self.REQUEST_TIMEOUT) < time.time():
break
isexc, obj = self._sync_replies.pop(seq)
if isexc:
raise obj
......
......@@ -256,6 +256,9 @@ class ThreadPool:
class RpycConnection(rpyc.Connection):
REQUEST_TIMEOUT = 60
def _send_request(self, seq, handler, args):
self._send(rpyc.core.consts.MSG_REQUEST, seq, (handler, self._box(args)))
return seq
......@@ -278,8 +281,12 @@ class RpycConnection(rpyc.Connection):
"""
seq = next(self._seqcounter)
self._send_request(seq, handler, args)
start = time.time()
while seq not in self._sync_replies:
self.serve(0.1)
if (start + self.REQUEST_TIMEOUT) < time.time():
break
isexc, obj = self._sync_replies.pop(seq)
if isexc:
raise obj
......
Supports Markdown
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