diff --git a/lib/build/rpc_definitions.py b/lib/build/rpc_definitions.py index 499df601d35da4f65983eeb27205d27b1b4efe52..79644b42e576b4baba3dd0170d6a0ff4f755dda9 100644 --- a/lib/build/rpc_definitions.py +++ b/lib/build/rpc_definitions.py @@ -37,7 +37,11 @@ RPC definition fields: """ -# Various time constants for the timeout table +# Guidelines for choosing timeouts: +# - call used during watcher: timeout of 1min, _TMO_URGENT +# - trivial (but be sure it is trivial) (e.g. reading a file): 5min, _TMO_FAST +# - other calls: 15 min, _TMO_NORMAL +# - special calls (instance add, etc.): either _TMO_SLOW (1h) or huge timeouts TMO_URGENT = 60 # one minute TMO_FAST = 5 * 60 # five minutes TMO_NORMAL = 15 * 60 # 15 minutes diff --git a/lib/rpc.py b/lib/rpc.py index cd681847652547280f9ae4f6caf4edb84c6d41d0..c4efad8072be6bcd3fd3e371281b0216808c9df9 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -71,16 +71,6 @@ _TMO_SLOW = 3600 # one hour _TMO_4HRS = 4 * 3600 _TMO_1DAY = 86400 -# Timeout table that will be built later by decorators -# Guidelines for choosing timeouts: -# - call used during watcher: timeout -> 1min, _TMO_URGENT -# - trivial (but be sure it is trivial) (e.g. reading a file): 5min, _TMO_FAST -# - other calls: 15 min, _TMO_NORMAL -# - special calls (instance add, etc.): either _TMO_SLOW (1h) or huge timeouts - -_TIMEOUTS = { -} - #: Special value to describe an offline host _OFFLINE = object() @@ -127,21 +117,6 @@ def _ConfigRpcCurl(curl): curl.setopt(pycurl.CONNECTTIMEOUT, _RPC_CONNECT_TIMEOUT) -def _RpcTimeout(secs): - """Timeout decorator. - - When applied to a rpc call_* function, it updates the global timeout - table with the given function/timeout. - - """ - def decorator(f): - name = f.__name__ - assert name.startswith("call_") - _TIMEOUTS[name[len("call_"):]] = secs - return f - return decorator - - def RunWithRPC(fn): """RPC-wrapper decorator. @@ -420,9 +395,6 @@ class _RpcProcessor: @param read_timeout: Read timeout for request """ - if read_timeout is None: - read_timeout = _TIMEOUTS.get(procedure, None) - assert read_timeout is not None, \ "Missing RPC read timeout for procedure '%s'" % procedure