Jason 1 rok temu
rodzic
commit
4a8b02fd59

+ 7 - 0
website_clickjobs/gen_seo2a.py

@@ -265,6 +265,12 @@ def exe():
         db.close()
         time.sleep(20)
 
+def cleanup():
+    try:
+        driver.quit()
+    except:
+        pass
+
 if __name__ == '__main__':
     runcount=1
     while True:
@@ -276,6 +282,7 @@ if __name__ == '__main__':
         if p.is_alive():
             print("Overtime")
             p.kill()
+            cleanup()
         p.join()
         duration = time.time()-start_time
         print("Runs: " + str(runcount) + " | Duration: " + str(duration))

+ 8 - 0
website_clickjobs/type-V/_execute.py

@@ -15,6 +15,8 @@ import json
 
 #from setting import rua
 
+driver=None
+
 db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
 table=db['nda_log']
 path = 'C:/ChromeDriver' #pls adjust
@@ -142,6 +144,12 @@ def execute(termlist, target, n, sr, se):
         parser.add_argument('--loop',action="store_true")
         args = parser.parse_args()
 
+def cleanup():
+    try:
+        driver.quit()
+    except:
+        pass
+
 # if args.loop:
 #     schedule.every(0.4).minutes.do(process_one)
 #     # print('今天開始')

+ 1 - 0
website_clickjobs/type-V/c2.py

@@ -37,6 +37,7 @@ if __name__ == '__main__':
                 p.join(120)
                 if p.is_alive():
                     print("Overtime")
+                    cleanup()
                     p.kill()
                 p.join()
                 duration = time.time()-start_time

+ 1 - 0
website_clickjobs/type-V/c2S.py

@@ -36,6 +36,7 @@ if __name__ == '__main__':
             p.join(120)
             if p.is_alive():
                 print("Overtime")
+                cleanup()
                 p.kill()
             p.join()
             duration = time.time()-start_time