diff --git a/mypy/build.py b/mypy/build.py index 96a67105c816c..c616faccadb37 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -315,10 +315,11 @@ def close(self) -> None: if self.connected: self.conn.close() # Technically we don't need to wait, but otherwise we will get ResourceWarnings. + # Also, it is generally good to not leave some running worker processes behind. try: self.proc.wait(timeout=WORKER_SHUTDOWN_TIMEOUT) except subprocess.TimeoutExpired: - pass + self.proc.terminate() if os.path.isfile(self.status_file): os.unlink(self.status_file) diff --git a/mypy/defaults.py b/mypy/defaults.py index d8197e4db00da..413a161129e28 100644 --- a/mypy/defaults.py +++ b/mypy/defaults.py @@ -51,7 +51,7 @@ # with our generous timeouts, so we set them higher. WORKER_START_INTERVAL: Final = 0.01 if sys.platform != "win32" else 0.03 WORKER_START_TIMEOUT: Final = 3 if sys.platform != "win32" else 10 -WORKER_SHUTDOWN_TIMEOUT: Final = 1 if sys.platform != "win32" else 3 +WORKER_SHUTDOWN_TIMEOUT: Final = 3 if sys.platform != "win32" else 10 WORKER_CONNECTION_TIMEOUT: Final = 10 WORKER_IDLE_TIMEOUT: Final = 600