Przeglądaj źródła

[update] 设置失败次数

jinghao_wb 8 lat temu
rodzic
commit
9e27c23d66
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      Schedule/ProxyCheck.py

+ 4 - 3
Schedule/ProxyCheck.py

@@ -22,9 +22,10 @@ from Util.utilFunction import validUsefulProxy
 from Manager.ProxyManager import ProxyManager
 from Util.LogHandler import LogHandler
 
+FAIL_COUNT = 2
 
-class ProxyCheck(ProxyManager, Thread):
 
+class ProxyCheck(ProxyManager, Thread):
     def __init__(self):
         ProxyManager.__init__(self)
         Thread.__init__(self)
@@ -47,7 +48,7 @@ class ProxyCheck(ProxyManager, Thread):
                 else:
                     self.log.info('ProxyCheck: {} validation fail'.format(proxy))
                     # 验证失败,计数器减1
-                    if counter and int(counter) < -5:
+                    if counter and int(counter) < -FAIL_COUNT:
                         self.log.info('ProxyCheck: {} fail too many, delete!'.format(proxy))
                         self.db.delete(proxy)
                     else:
@@ -59,4 +60,4 @@ class ProxyCheck(ProxyManager, Thread):
 
 if __name__ == '__main__':
     p = ProxyCheck()
-    p.run()
+    p.run()