Skip to content

Commit 2563dfc

Browse files
authored
Use a more thorough cleanup of parallel workers (#21981)
Ref #21905 Hopefully this will reduce parallel test flakiness on heavy load machines.
1 parent e53d6a7 commit 2563dfc

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

mypy/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,11 @@ def close(self) -> None:
315315
if self.connected:
316316
self.conn.close()
317317
# Technically we don't need to wait, but otherwise we will get ResourceWarnings.
318+
# Also, it is generally good to not leave some running worker processes behind.
318319
try:
319320
self.proc.wait(timeout=WORKER_SHUTDOWN_TIMEOUT)
320321
except subprocess.TimeoutExpired:
321-
pass
322+
self.proc.terminate()
322323
if os.path.isfile(self.status_file):
323324
os.unlink(self.status_file)
324325

mypy/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# with our generous timeouts, so we set them higher.
5252
WORKER_START_INTERVAL: Final = 0.01 if sys.platform != "win32" else 0.03
5353
WORKER_START_TIMEOUT: Final = 3 if sys.platform != "win32" else 10
54-
WORKER_SHUTDOWN_TIMEOUT: Final = 1 if sys.platform != "win32" else 3
54+
WORKER_SHUTDOWN_TIMEOUT: Final = 3 if sys.platform != "win32" else 10
5555

5656
WORKER_CONNECTION_TIMEOUT: Final = 10
5757
WORKER_IDLE_TIMEOUT: Final = 600

0 commit comments

Comments
 (0)