rename --worker-v2 to --worker
No V1 means no need for the suffix. Update flag, function name, compose command, log messages, and docs.
This commit is contained in:
16
ppf.py
16
ppf.py
@@ -328,7 +328,7 @@ def worker_send_heartbeat(server_url, worker_key, tor_ok, tor_ip=None, profiling
|
||||
|
||||
|
||||
def worker_claim_urls(server_url, worker_key, count=5):
|
||||
"""Claim batch of URLs for V2 worker mode."""
|
||||
"""Claim batch of URLs for worker mode."""
|
||||
url = '%s/api/claim-urls?key=%s&count=%d' % (server_url.rstrip('/'), worker_key, count)
|
||||
|
||||
try:
|
||||
@@ -428,8 +428,8 @@ def check_tor_connectivity(tor_hosts):
|
||||
return working, tor_ip
|
||||
|
||||
|
||||
def worker_v2_main(config):
|
||||
"""V2 worker mode -- URL-driven discovery.
|
||||
def worker_main(config):
|
||||
"""Worker mode -- URL-driven discovery.
|
||||
|
||||
Claims URLs from master, fetches through Tor, extracts and tests proxies,
|
||||
reports working proxies back to master.
|
||||
@@ -470,7 +470,7 @@ def worker_v2_main(config):
|
||||
if config.args.register:
|
||||
return
|
||||
|
||||
_log('starting worker V2 mode (URL-driven)', 'info')
|
||||
_log('starting worker mode (URL-driven)', 'info')
|
||||
_log(' server: %s' % server_url, 'info')
|
||||
_log(' threads: %d' % num_threads, 'info')
|
||||
_log(' url batch: %d' % url_batch_size, 'info')
|
||||
@@ -823,13 +823,13 @@ def worker_v2_main(config):
|
||||
|
||||
except KeyboardInterrupt:
|
||||
elapsed = time.time() - start_time
|
||||
_log('worker V2 stopping...', 'info')
|
||||
_log('worker stopping...', 'info')
|
||||
session.close()
|
||||
for wt in threads:
|
||||
wt.stop()
|
||||
for wt in threads:
|
||||
wt.term()
|
||||
_log('worker V2 stopped after %s' % format_duration(int(elapsed)), 'info')
|
||||
_log('worker stopped after %s' % format_duration(int(elapsed)), 'info')
|
||||
_log(' cycles: %d' % cycles, 'info')
|
||||
_log(' urls fetched: %d' % urls_fetched, 'info')
|
||||
_log(' proxies found: %d' % proxies_found, 'info')
|
||||
@@ -849,8 +849,8 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
# Worker mode: URL-driven discovery
|
||||
if config.args.worker_v2 or config.args.register:
|
||||
worker_v2_main(config)
|
||||
if config.args.worker or config.args.register:
|
||||
worker_main(config)
|
||||
return
|
||||
|
||||
proxydb = mysqlite.mysqlite(config.watchd.database, str)
|
||||
|
||||
Reference in New Issue
Block a user