Skip to content

Commit 832d641

Browse files
committed
fix: use default pool method and add comment
1 parent 3f66585 commit 832d641

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

codecov_cli/services/staticanalysis/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import asyncio
22
import json
33
import logging
4-
import sys
54
import typing
65
from functools import partial
7-
from multiprocessing import get_context
6+
from multiprocessing import Pool
87
from pathlib import Path
98

109
import click
@@ -184,15 +183,13 @@ async def process_files(
184183
all_data = {}
185184
file_metadata = []
186185
errors = {}
187-
if sys.platform.startswith("win32") or sys.platform.startswith("darwin"):
188-
pool_thread_method = "spawn"
189-
else:
190-
pool_thread_method = "fork"
191186
with click.progressbar(
192187
length=len(files_to_analyze),
193188
label="Analyzing files",
194189
) as bar:
195-
with get_context(pool_thread_method).Pool(processes=numberprocesses) as pool:
190+
# https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
191+
# from the link above, we want to use the default start methods
192+
with Pool(processes=numberprocesses) as pool:
196193
file_results = pool.imap_unordered(mapped_func, files_to_analyze)
197194
for result in file_results:
198195
bar.update(1, result)

0 commit comments

Comments
 (0)