watchd: introduce configurable 'outage_threshold'

This commit is contained in:
rofl0r
2019-01-18 15:34:49 +00:00
parent aaac14d34e
commit ddee92d20f
3 changed files with 3 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ debug = false
checktime = 3600
perfail_checktime = 3600
database = proxies.sqlite
outage_threshold = 4
[ppf]
max_fail = 5

View File

@@ -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)
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, '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)

View File

@@ -286,7 +286,7 @@ class Proxywatchd():
success_rate = (float(sc) / len(self.collected)) * 100
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")
if sc == 0: return False
args = []