make watchd.tor_safeguard a configurable option (default: True)
This commit is contained in:
@@ -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_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, '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, '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'
|
section = 'ppf'
|
||||||
self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False)
|
self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False)
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class Proxywatchd():
|
|||||||
# check oldies ?
|
# check oldies ?
|
||||||
if len(rows) < config.watchd.threads and config.watchd.oldies:
|
if len(rows) < config.watchd.threads and config.watchd.oldies:
|
||||||
## disable tor safeguard for old proxies
|
## disable tor safeguard for old proxies
|
||||||
self.tor_safeguard = False
|
if self.tor_safeguard: self.tor_safeguard = False
|
||||||
q += ' LIMIT ?'
|
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()
|
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
|
return rows
|
||||||
@@ -274,7 +274,7 @@ class Proxywatchd():
|
|||||||
def prepare_jobs(self):
|
def prepare_jobs(self):
|
||||||
self._prep_db()
|
self._prep_db()
|
||||||
## enable tor safeguard by default
|
## enable tor safeguard by default
|
||||||
self.tor_safeguard = True
|
self.tor_safeguard = config.watchd.tor_safeguard
|
||||||
rows = self.fetch_rows()
|
rows = self.fetch_rows()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
job = WorkerJob(row[0], row[1], row[2], row[3], row[4])
|
job = WorkerJob(row[0], row[1], row[2], row[3], row[4])
|
||||||
|
|||||||
Reference in New Issue
Block a user