make watchd.tor_safeguard a configurable option (default: True)

This commit is contained in:
Mickaël Serneels
2019-04-09 21:22:52 +02:00
parent 59eea18bca
commit bad4d25bcf
2 changed files with 3 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ class Config(ComboParser):
self.add_item(section, 'oldies_checktime', int, 43200, 'base checking interval for *old* proxies in seconds (default: 43200)', False)
self.add_item(section, 'oldies_multi', int, 100, 'fetch threads*multi rows when testing oldies (default: 100)', False)
self.add_item(section, 'source_file', str, 'servers.txt', 'server/url list to read from (default: servers.txt)', False)
self.add_item(section, 'tor_safeguard', bool, True, 'enable tor safeguard (default: True)', False)
section = 'ppf'
self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False)

View File

@@ -266,7 +266,7 @@ class Proxywatchd():
# check oldies ?
if len(rows) < config.watchd.threads and config.watchd.oldies:
## disable tor safeguard for old proxies
self.tor_safeguard = False
if self.tor_safeguard: self.tor_safeguard = False
q += ' LIMIT ?'
rows = self.mysqlite.execute(q, (config.watchd.max_fail, config.watchd.max_fail*2, config.watchd.checktime, config.watchd.oldies_checktime, time.time(), config.watchd.threads*config.watchd.oldies_multi)).fetchall()
return rows
@@ -274,7 +274,7 @@ class Proxywatchd():
def prepare_jobs(self):
self._prep_db()
## enable tor safeguard by default
self.tor_safeguard = True
self.tor_safeguard = config.watchd.tor_safeguard
rows = self.fetch_rows()
for row in rows:
job = WorkerJob(row[0], row[1], row[2], row[3], row[4])