From 35285a84bf8ba4bbf7775f37911248f6fd058422 Mon Sep 17 00:00:00 2001 From: Username Date: Sun, 22 Feb 2026 10:04:28 +0100 Subject: [PATCH] watchd: update last_seen on successful proxy verification Serving endpoints filter by last_seen >= now - 3600, but watchd never set last_seen -- only worker reports did. This caused the API to return 0 proxies despite 70+ passing verification. --- proxywatchd.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/proxywatchd.py b/proxywatchd.py index 69b7cdb..8bf33ae 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -1292,16 +1292,17 @@ class VerificationThread(threading.Thread): dbs.update_worker_trust(db, worker_a, was_correct) # Update proxy status with authoritative result + now_int = int(time.time()) if result: db.execute(''' - UPDATE proxylist SET failed = 0, tested = ? + UPDATE proxylist SET failed = 0, tested = ?, last_seen = ? WHERE proxy = ? - ''', (int(time.time()), proxy)) + ''', (now_int, now_int, proxy)) else: db.execute(''' UPDATE proxylist SET failed = failed + 1, tested = ? WHERE proxy = ? - ''', (int(time.time()), proxy)) + ''', (now_int, proxy)) # Remove from verification queue dbs.remove_from_verification_queue(db, proxy) @@ -1684,7 +1685,7 @@ class Proxywatchd(): args.append((effective_failcount, job.checktime, 1, job.country, job.proto, job.success_count, job.total_duration, job.mitm, job.consecutive_success, job.asn, job.protos_working, - job.last_check, job.last_target, job.proxy)) + job.last_check, job.last_target, effective_failcount, job.proxy)) success_rate = (float(sc) / len(self.collected)) * 100 ret = True @@ -1699,7 +1700,7 @@ class Proxywatchd(): args.append((job.failcount, job.checktime, 1, job.country, job.proto, job.success_count, job.total_duration, job.mitm, job.consecutive_success, job.asn, job.protos_working, - job.last_check, job.last_target, job.proxy)) + job.last_check, job.last_target, job.failcount, job.proxy)) if job.last_latency_ms is not None: latency_updates.append((job.proxy, job.last_latency_ms)) ret = False @@ -1720,7 +1721,7 @@ class Proxywatchd(): live_args = [a for a in args if a[0] != DEAD_PROXY and a[0] < max_fail] with self._db_context() as db: - query = 'UPDATE proxylist SET failed=?,tested=?,dronebl=?,country=?,proto=?,success_count=?,total_duration=?,mitm=?,consecutive_success=?,asn=?,protos_working=?,last_check=?,last_target=? WHERE proxy=?' + query = 'UPDATE proxylist SET failed=?,tested=?,dronebl=?,country=?,proto=?,success_count=?,total_duration=?,mitm=?,consecutive_success=?,asn=?,protos_working=?,last_check=?,last_target=?,last_seen=CASE WHEN ?=0 THEN strftime("%s","now") ELSE last_seen END WHERE proxy=?' if live_args: db.executemany(query, live_args)