From: Cameron Dale Date: Sat, 3 May 2008 17:21:38 +0000 (-0700) Subject: Lower the timeout to 9 sec to reduce delays. X-Git-Url: https://git.mxchange.org/?p=quix0rs-apt-p2p.git;a=commitdiff_plain;h=17b7fb5f34a147cf61191d857a4735ec9e331842 Lower the timeout to 9 sec to reduce delays. --- diff --git a/apt-p2p.conf b/apt-p2p.conf index e3512c8..1031d1e 100644 --- a/apt-p2p.conf +++ b/apt-p2p.conf @@ -114,14 +114,14 @@ BUCKET_STALENESS = 1h KEY_EXPIRE = 3h # Timeout KRPC requests to nodes after this time. -KRPC_TIMEOUT = 14s +KRPC_TIMEOUT = 9s # KRPC requests are resent using exponential backoff starting with this delay. # The request will first be resent after the delay set here. # The request will be resent again after twice the delay set here. etc. -# e.g. if TIMEOUT is 14 sec., and INITIAL_DELAY is 2 sec., then requests will +# e.g. if TIMEOUT is 9 sec., and INITIAL_DELAY is 2 sec., then requests will # be resent at times 0, 2 (2 sec. later), and 6 (4 sec. later), and then will -# timeout at 14. +# timeout at 9. KRPC_INITIAL_DELAY = 2s # whether to spew info about the requests/responses in the protocol diff --git a/apt_p2p/apt_p2p_conf.py b/apt_p2p/apt_p2p_conf.py index de7cc60..169a60b 100644 --- a/apt_p2p/apt_p2p_conf.py +++ b/apt_p2p/apt_p2p_conf.py @@ -124,14 +124,14 @@ DHT_DEFAULTS = { 'KEY_EXPIRE': '3h', # 3 hours # Timeout KRPC requests to nodes after this time. - 'KRPC_TIMEOUT': '14s', + 'KRPC_TIMEOUT': '9s', # KRPC requests are resent using exponential backoff starting with this delay. # The request will first be resent after the delay set here. # The request will be resent again after twice the delay set here. etc. - # e.g. if TIMEOUT is 14 sec., and INITIAL_DELAY is 2 sec., then requests will + # e.g. if TIMEOUT is 9 sec., and INITIAL_DELAY is 2 sec., then requests will # be resent at times 0, 2 (2 sec. later), and 6 (4 sec. later), and then will - # timeout at 14. + # timeout at 9. 'KRPC_INITIAL_DELAY': '2s', # whether to spew info about the requests/responses in the protocol diff --git a/apt_p2p_Khashmir/DHT.py b/apt_p2p_Khashmir/DHT.py index cc3660c..af24730 100644 --- a/apt_p2p_Khashmir/DHT.py +++ b/apt_p2p_Khashmir/DHT.py @@ -337,7 +337,7 @@ class TestSimpleDHT(unittest.TestCase): 'STORE_REDUNDANCY': 3, 'RETRIEVE_VALUES': -10000, 'MAX_FAILURES': 3, 'LOCAL_OK': True, 'MIN_PING_INTERVAL': 900,'BUCKET_STALENESS': 3600, - 'KRPC_TIMEOUT': 14, 'KRPC_INITIAL_DELAY': 2, + 'KRPC_TIMEOUT': 9, 'KRPC_INITIAL_DELAY': 2, 'KEY_EXPIRE': 3600, 'SPEW': True, } def setUp(self): @@ -458,7 +458,7 @@ class TestMultiDHT(unittest.TestCase): 'STORE_REDUNDANCY': 3, 'RETRIEVE_VALUES': -10000, 'MAX_FAILURES': 3, 'LOCAL_OK': True, 'MIN_PING_INTERVAL': 900,'BUCKET_STALENESS': 3600, - 'KRPC_TIMEOUT': 14, 'KRPC_INITIAL_DELAY': 2, + 'KRPC_TIMEOUT': 9, 'KRPC_INITIAL_DELAY': 2, 'KEY_EXPIRE': 3600, 'SPEW': True, } def setUp(self): diff --git a/apt_p2p_Khashmir/khashmir.py b/apt_p2p_Khashmir/khashmir.py index 9509ce6..74263a6 100644 --- a/apt_p2p_Khashmir/khashmir.py +++ b/apt_p2p_Khashmir/khashmir.py @@ -563,7 +563,7 @@ class SimpleTests(unittest.TestCase): 'STORE_REDUNDANCY': 3, 'RETRIEVE_VALUES': -10000, 'MAX_FAILURES': 3, 'LOCAL_OK': True, 'MIN_PING_INTERVAL': 900,'BUCKET_STALENESS': 3600, - 'KRPC_TIMEOUT': 14, 'KRPC_INITIAL_DELAY': 2, + 'KRPC_TIMEOUT': 9, 'KRPC_INITIAL_DELAY': 2, 'KEY_EXPIRE': 3600, 'SPEW': True, } def setUp(self): @@ -637,7 +637,7 @@ class MultiTest(unittest.TestCase): 'STORE_REDUNDANCY': 3, 'RETRIEVE_VALUES': -10000, 'MAX_FAILURES': 3, 'LOCAL_OK': True, 'MIN_PING_INTERVAL': 900,'BUCKET_STALENESS': 3600, - 'KRPC_TIMEOUT': 14, 'KRPC_INITIAL_DELAY': 2, + 'KRPC_TIMEOUT': 9, 'KRPC_INITIAL_DELAY': 2, 'KEY_EXPIRE': 3600, 'SPEW': True, } def _done(self, val): diff --git a/apt_p2p_Khashmir/krpc.py b/apt_p2p_Khashmir/krpc.py index a2afac7..97186a0 100644 --- a/apt_p2p_Khashmir/krpc.py +++ b/apt_p2p_Khashmir/krpc.py @@ -253,7 +253,7 @@ class KrpcRequest(defer.Deferred): """Check for a unrecoverable timeout, otherwise resend.""" self.later = None delay = datetime.now() - self.start - if delay > timedelta(seconds = self.config.get('KRPC_TIMEOUT', 14)): + if delay > timedelta(seconds = self.config.get('KRPC_TIMEOUT', 9)): log.msg('%r timed out after %0.2f sec' % (self.tid, delay.seconds + delay.microseconds/1000000.0)) self.protocol.timeOut(self.tid, self.method) @@ -584,7 +584,7 @@ def make(port): from stats import StatsLogger af = Receiver() a = hostbroker(af, StatsLogger(None, None), - {'KRPC_TIMEOUT': 14, 'KRPC_INITIAL_DELAY': 2, 'SPEW': False}) + {'KRPC_TIMEOUT': 9, 'KRPC_INITIAL_DELAY': 2, 'SPEW': False}) a.protocol = KRPC p = reactor.listenUDP(port, a) return af, a, p diff --git a/debian/apt-p2p.conf.sgml b/debian/apt-p2p.conf.sgml index cf10b44..47d4547 100644 --- a/debian/apt-p2p.conf.sgml +++ b/debian/apt-p2p.conf.sgml @@ -282,7 +282,7 @@ The time to wait before KRPC requests timeout. - (Default is 14 seconds.) + (Default is 9 seconds.) @@ -291,9 +291,9 @@ The time to start with when resending KRPC requests using exponential backoff. The request will first be resent after the delay set here. The request will be resent again after twice the delay set here, and so on. - e.g. if TIMEOUT is 14 sec., and INITIAL_DELAY is 2 sec., then requests will + e.g. if TIMEOUT is 9 sec., and INITIAL_DELAY is 2 sec., then requests will be resent at times 0, 2 (2 sec. later), and 6 (4 sec. later), and then will - timeout at 14. (Default is 2 seconds.) + timeout at 9. (Default is 2 seconds.) diff --git a/test.py b/test.py index a04903c..1abbe3a 100755 --- a/test.py +++ b/test.py @@ -522,14 +522,14 @@ LOCAL_OK = yes KEY_EXPIRE = 3h # Timeout KRPC requests to nodes after this time. -KRPC_TIMEOUT = 14s +KRPC_TIMEOUT = 9s # KRPC requests are resent using exponential backoff starting with this delay. # The request will first be resent after the delay set here. # The request will be resent again after twice the delay set here. etc. -# e.g. if TIMEOUT is 14 sec., and INITIAL_DELAY is 2 sec., then requests will +# e.g. if TIMEOUT is 9 sec., and INITIAL_DELAY is 2 sec., then requests will # be resent at times 0, 2 (2 sec. later), and 6 (4 sec. later), and then will -# timeout at 14. +# timeout at 9. KRPC_INITIAL_DELAY = 2s # whether to spew info about the requests/responses in the protocol