From 753f5fc5174bcd622c7654b8000319b758ec5341 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sat, 24 Jun 2023 11:36:15 +0100 Subject: [PATCH] compile_mjml: use multiprocessing instead of thread --- scripts/compile_mjml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/compile_mjml.py b/scripts/compile_mjml.py index 8341c5e..fc5e09d 100755 --- a/scripts/compile_mjml.py +++ b/scripts/compile_mjml.py @@ -3,7 +3,7 @@ import shutil import os import argparse from pathlib import Path -from threading import Thread +from multiprocessing import Process parser = argparse.ArgumentParser() parser.add_argument("-o", "--output", help="output directory for .html and .txt files") @@ -27,10 +27,10 @@ local_path = Path("mail") threads = [] 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: thread.join()