mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
compile_mjml: use multiprocessing instead of thread
This commit is contained in:
parent
f1b7ef303d
commit
753f5fc517
@ -3,7 +3,7 @@ import shutil
|
|||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from multiprocessing import Process
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-o", "--output", help="output directory for .html and .txt files")
|
parser.add_argument("-o", "--output", help="output directory for .html and .txt files")
|
||||||
@ -27,10 +27,10 @@ local_path = Path("mail")
|
|||||||
threads = []
|
threads = []
|
||||||
|
|
||||||
for mjml in [f for f in local_path.iterdir() if f.is_file() and "mjml" in f.suffix]:
|
for mjml in [f for f in local_path.iterdir() if f.is_file() and "mjml" in f.suffix]:
|
||||||
threads.append(Thread(target=compile, args=(mjml,)))
|
p = Process(target=compile, args=(mjml,))
|
||||||
|
p.start()
|
||||||
|
threads.append(p)
|
||||||
|
|
||||||
for thread in threads:
|
|
||||||
thread.start()
|
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
thread.join()
|
thread.join()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user