From 61e22fea87ff506aa77d4224412586155e12854d Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Tue, 7 May 2024 21:02:30 -0700 Subject: [PATCH] Make sure to use no more than 61 cpus on windows (#17958) * Make sure to use no more than 61 cpus on windows * Type fix --- chia/util/misc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chia/util/misc.py b/chia/util/misc.py index c147207ec5..79d5f7ef00 100644 --- a/chia/util/misc.py +++ b/chia/util/misc.py @@ -417,7 +417,12 @@ def available_logical_cores() -> int: assert count is not None return count - return len(psutil.Process().cpu_affinity()) + cores = len(psutil.Process().cpu_affinity()) + + if sys.platform == "win32": + cores = min(61, cores) # https://github.com/python/cpython/issues/89240 + + return cores def caller_file_and_line(distance: int = 1, relative_to: Iterable[Path] = ()) -> Tuple[str, int]: