Skip to content

Commit bb74d7f

Browse files
committed
Change thread pool method in process_files
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
1 parent da34344 commit bb74d7f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

codecov_cli/services/staticanalysis/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from functools import partial
66
from multiprocessing import get_context
77
from pathlib import Path
8+
import sys
89

910
import click
1011
import httpx
@@ -183,11 +184,15 @@ async def process_files(
183184
all_data = {}
184185
file_metadata = []
185186
errors = {}
187+
if sys.platform.startswith("win32") or sys.platform.startswith("darwin"):
188+
pool_thread_method = "spawn"
189+
else:
190+
pool_thread_method = "fork"
186191
with click.progressbar(
187192
length=len(files_to_analyze),
188193
label="Analyzing files",
189194
) as bar:
190-
with get_context("fork").Pool(processes=numberprocesses) as pool:
195+
with get_context(pool_thread_method).Pool(processes=numberprocesses) as pool:
191196
file_results = pool.imap_unordered(mapped_func, files_to_analyze)
192197
for result in file_results:
193198
bar.update(1, result)

0 commit comments

Comments
 (0)