feat: 测活覆盖全部代理(含死记录),拨活即复活
ListProxiesDue 去掉 alive=1 限制:死代理每小时也重测,协议级握手 成功就 MarkProxyAlive 复活(fail_count 清零),不再只能等同步时 重新出现在源列表才复活。 附带:提取页加「带协议前缀」开关,复制链接自动带 fmt=url。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -208,7 +208,7 @@ WHERE id = ?;
|
||||
DELETE FROM proxies WHERE id = ?;
|
||||
|
||||
-- name: ListProxiesDue :many
|
||||
SELECT id, ip, port, protocols, fail_count FROM proxies WHERE alive = 1 AND last_checked_at < ? ORDER BY last_checked_at LIMIT 20000;
|
||||
SELECT id, ip, port, protocols, fail_count FROM proxies WHERE last_checked_at < ? ORDER BY last_checked_at LIMIT 20000;
|
||||
|
||||
-- name: MarkProxyAlive :exec
|
||||
UPDATE proxies SET last_checked_at = ?, alive = 1, fail_count = 0, last_alive_at = ?, latency = ? WHERE id = ?;
|
||||
|
||||
@@ -1887,7 +1887,7 @@ func (q *Queries) ListPendingPayOrders(ctx context.Context) ([]PayOrder, error)
|
||||
}
|
||||
|
||||
const listProxiesDue = `-- name: ListProxiesDue :many
|
||||
SELECT id, ip, port, protocols, fail_count FROM proxies WHERE alive = 1 AND last_checked_at < ? ORDER BY last_checked_at LIMIT 20000
|
||||
SELECT id, ip, port, protocols, fail_count FROM proxies WHERE last_checked_at < ? ORDER BY last_checked_at LIMIT 20000
|
||||
`
|
||||
|
||||
type ListProxiesDueRow struct {
|
||||
|
||||
@@ -297,8 +297,8 @@ func runProxySync(ctx context.Context, st *store.Store) {
|
||||
sync.Total, sync.Added, sync.Updated, sync.Removed, failed)
|
||||
}
|
||||
|
||||
// runProxyCheck 测活一轮:取距上次检测超过阈值的存活代理,并发 TCP 拨测;
|
||||
// 连不上即标记为死(alive=0),死记录超过保留期后物理清除。
|
||||
// runProxyCheck 测活一轮:取距上次检测超过阈值的全部代理(含死记录,拨活即复活),
|
||||
// 并发协议级拨测;连不上即标记为死(alive=0),死记录超过保留期后物理清除。
|
||||
func runProxyCheck(ctx context.Context, st *store.Store) {
|
||||
if !proxyChecking.CompareAndSwap(false, true) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user