add test provenance columns and worker report fields
Add last_check/last_target columns to proxylist schema with migration. Include checktype and target in V2 worker report payload.
This commit is contained in:
15
dbs.py
15
dbs.py
@@ -98,6 +98,16 @@ def _migrate_last_seen(sqlite):
|
||||
sqlite.commit()
|
||||
|
||||
|
||||
def _migrate_last_check_columns(sqlite):
|
||||
"""Add last_check and last_target columns for test provenance tracking."""
|
||||
for col, typedef in (('last_check', 'TEXT'), ('last_target', 'TEXT')):
|
||||
try:
|
||||
sqlite.execute('SELECT %s FROM proxylist LIMIT 1' % col)
|
||||
except Exception:
|
||||
sqlite.execute('ALTER TABLE proxylist ADD COLUMN %s %s' % (col, typedef))
|
||||
sqlite.commit()
|
||||
|
||||
|
||||
def _migrate_uri_check_interval(sqlite):
|
||||
"""Add adaptive check_interval column to uris table."""
|
||||
try:
|
||||
@@ -371,7 +381,9 @@ def create_table_if_not_exists(sqlite, dbname):
|
||||
source_proto TEXT,
|
||||
source_confidence INT DEFAULT 0,
|
||||
protos_working TEXT,
|
||||
last_seen INT DEFAULT 0)""")
|
||||
last_seen INT DEFAULT 0,
|
||||
last_check TEXT,
|
||||
last_target TEXT)""")
|
||||
# Migration: add columns to existing databases (must run before creating indexes)
|
||||
_migrate_latency_columns(sqlite)
|
||||
_migrate_anonymity_columns(sqlite)
|
||||
@@ -381,6 +393,7 @@ def create_table_if_not_exists(sqlite, dbname):
|
||||
_migrate_source_proto(sqlite)
|
||||
_migrate_protos_working(sqlite)
|
||||
_migrate_last_seen(sqlite)
|
||||
_migrate_last_check_columns(sqlite)
|
||||
# Indexes for common query patterns
|
||||
sqlite.execute('CREATE INDEX IF NOT EXISTS idx_proxylist_failed ON proxylist(failed)')
|
||||
sqlite.execute('CREATE INDEX IF NOT EXISTS idx_proxylist_tested ON proxylist(tested)')
|
||||
|
||||
2
ppf.py
2
ppf.py
@@ -1134,6 +1134,8 @@ def worker_v2_main(config):
|
||||
'latency': round(latency_sec, 3),
|
||||
'exit_ip': state.exit_ip,
|
||||
'source_url': source_map.get(proxy_addr) or source_map.get(state.proxy, ''),
|
||||
'checktype': state.last_check or '',
|
||||
'target': state.last_target or '',
|
||||
})
|
||||
|
||||
if completed % 50 == 0 or completed == len(all_jobs):
|
||||
|
||||
Reference in New Issue
Block a user