implemented worker restarter
This commit is contained in:
parent
e8adbeb401
commit
22dc3e98b7
@ -35,6 +35,15 @@ def worker(outqueue, id):
|
||||
|
||||
outqueue.put(del_list)
|
||||
|
||||
|
||||
def worker_watchdog(outqueue, id):
|
||||
while True:
|
||||
try:
|
||||
worker(outqueue, id)
|
||||
except:
|
||||
print(f"Worker {id} died! Restarting...")
|
||||
|
||||
|
||||
def main():
|
||||
target_url = os.environ['TARGET_URL']
|
||||
multiprocessing.set_start_method('spawn')
|
||||
@ -42,7 +51,7 @@ def main():
|
||||
processes = []
|
||||
|
||||
for id in range(os.cpu_count()):
|
||||
p = multiprocessing.Process(target=worker, args=(outqueue, id))
|
||||
p = multiprocessing.Process(target=worker_watchdog, args=(outqueue, id))
|
||||
p.start()
|
||||
processes.append(p)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user