diff --git a/spider/main.py b/spider/main.py index 6628548..8405fb9 100644 --- a/spider/main.py +++ b/spider/main.py @@ -647,7 +647,7 @@ def proxy_loop(proxy: str, stop_event: threading.Event) -> None: while not stop_event.is_set(): try: if is_forbidden_time(): - if stop_event.wait(timeout=60): + if stop_event.wait(timeout=300): break cleanup_all_browsers() secs = seconds_until(20, 0) @@ -779,7 +779,7 @@ def main(): restart_event = threading.Event() if is_forbidden_time(): - if stop_event.wait(timeout=60): + if stop_event.wait(timeout=300): continue cleanup_all_browsers() secs = seconds_until(20, 0) @@ -802,18 +802,18 @@ def main(): if restart_event.is_set(): stop_event.set() try: - executor.shutdown(wait=False) + executor.shutdown(wait=True) except Exception: pass break if is_forbidden_time(): - logger.info("进入禁跑时段,停止当前批次,等待1分钟后清理指纹浏览器") + logger.info("进入禁跑时段,停止当前批次,等待5分钟后清理指纹浏览器") stop_event.set() try: - executor.shutdown(wait=False) + executor.shutdown(wait=True) except Exception: pass - time.sleep(60) + time.sleep(300) cleanup_all_browsers() break for f, proxy in list(futures_map.items()): @@ -836,7 +836,7 @@ def main(): pass finally: try: - executor.shutdown(wait=False) + executor.shutdown(wait=True) except Exception: pass continue