watchd: introduce configurable 'outage_threshold'
This commit is contained in:
@@ -11,6 +11,7 @@ debug = false
|
|||||||
checktime = 3600
|
checktime = 3600
|
||||||
perfail_checktime = 3600
|
perfail_checktime = 3600
|
||||||
database = proxies.sqlite
|
database = proxies.sqlite
|
||||||
|
outage_threshold = 4
|
||||||
|
|
||||||
[ppf]
|
[ppf]
|
||||||
max_fail = 5
|
max_fail = 5
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class Config(ComboParser):
|
|||||||
self.add_item(section, 'tor_hosts', str, '127.0.0.1:9050', 'comma-separated list of tor proxy address(es)', True)
|
self.add_item(section, 'tor_hosts', str, '127.0.0.1:9050', 'comma-separated list of tor proxy address(es)', True)
|
||||||
|
|
||||||
section = 'watchd'
|
section = 'watchd'
|
||||||
|
self.add_item(section, 'outage_threshold', float, 4.0, 'mininum success percentage required to not drop check results', False)
|
||||||
self.add_item(section, 'max_fail', int, 5, 'number of fails after which a proxy is considered dead', False)
|
self.add_item(section, 'max_fail', int, 5, 'number of fails after which a proxy is considered dead', False)
|
||||||
self.add_item(section, 'threads', int, 10, 'number of threads watchd uses to check proxies', True)
|
self.add_item(section, 'threads', int, 10, 'number of threads watchd uses to check proxies', True)
|
||||||
self.add_item(section, 'timeout', int, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False)
|
self.add_item(section, 'timeout', int, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False)
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ class Proxywatchd():
|
|||||||
|
|
||||||
success_rate = (float(sc) / len(self.collected)) * 100
|
success_rate = (float(sc) / len(self.collected)) * 100
|
||||||
ret = True
|
ret = True
|
||||||
if len(self.collected) >= 100 and success_rate <= 2.0:
|
if len(self.collected) >= 100 and success_rate <= config.watchd.outage_threshold:
|
||||||
_log("WATCHD %.2f%% SUCCESS RATE - tor circuit blocked? won't submit fails"%success_rate, "ERROR")
|
_log("WATCHD %.2f%% SUCCESS RATE - tor circuit blocked? won't submit fails"%success_rate, "ERROR")
|
||||||
if sc == 0: return False
|
if sc == 0: return False
|
||||||
args = []
|
args = []
|
||||||
|
|||||||
Reference in New Issue
Block a user