From 0d1e78dda214045d1d752bc1f98289bdd2f37f0c Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 26 Oct 2011 12:36:42 +0200 Subject: [PATCH] rpc: Remove leftovers from timeout table Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/build/rpc_definitions.py | 6 +++++- lib/rpc.py | 28 ---------------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/lib/build/rpc_definitions.py b/lib/build/rpc_definitions.py index 499df601d..79644b42e 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 cd6818476..c4efad807 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 -- GitLab