derrickx 1 éve
szülő
commit
6d32d3d06a
1 módosított fájl, 22 hozzáadás és 22 törlés
  1. 22 22
      app.py

+ 22 - 22
app.py

@@ -270,28 +270,28 @@ def process_account(pocket_url, account, log_name, single_proxy, random_index):
 
 def process_running(max_threads, pocket_url):
     log_name = f"data_{datetime.datetime.now().strftime('%Y%m%d%H%M')}.txt"
-    with open('livepocket/account.txt', 'r') as accounts:
-        account_list = accounts.readlines()
-
-    threads = []
-    for account in account_list:
-
-        # 直接从redis中获取
-        single_proxy, random_index = get_random_proxy_at_redis(600)
-        thread = threading.Thread(target=process_account,
-                                  args=(pocket_url, account, log_name, single_proxy, random_index))
-        threads.append(thread)
-        thread.start()
-
-        # 如果当前线程数达到上限,等待有线程结束后再创建新线程
-        if len(threads) >= max_threads:
-            for t in threads:
-                t.join()
-            threads.clear()
-
-    # 等待所有线程执行完毕
-    for thread in threads:
-        thread.join()
+
+    while True:
+        with open('livepocket/account.txt', 'r') as accounts:
+            account_list = accounts.readlines()
+
+        threads = []
+        for account in account_list:
+            single_proxy, random_index = get_random_proxy_at_redis(600)
+            thread = threading.Thread(target=process_account,
+                                      args=(pocket_url, account.strip(), log_name, single_proxy, random_index))
+            threads.append(thread)
+            thread.start()
+
+            # 如果当前线程数达到上限,等待有线程结束后再创建新线程
+            if len(threads) == max_threads:
+                for t in threads:
+                    t.join()
+                threads.clear()
+
+        # 等待所有线程执行完毕
+        for thread in threads:
+            thread.join()
 
 
 def run_poc(account, password, url, log_name, single_proxy, random_index):