diff --git a/config.ini.sample b/config.ini.sample index 201a1be..c009403 100644 --- a/config.ini.sample +++ b/config.ini.sample @@ -11,6 +11,7 @@ debug = false checktime = 3600 perfail_checktime = 3600 database = proxies.sqlite +outage_threshold = 4 [ppf] max_fail = 5 diff --git a/config.py b/config.py index 862a377..aab303f 100644 --- a/config.py +++ b/config.py @@ -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) diff --git a/proxywatchd.py b/proxywatchd.py index 513710b..08ff00c 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -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 = []