Skip to content

Commit 98d1109

Browse files
committed
Fix problem when using 0 seconds for stop timeout
It seems as if this was caused by an update to one of the dependencies (maybe anyio?!). The CI pipeline did still pass for Linux, but raised some warning about the event loop already being closed on the worker thread.
1 parent 84e0c91 commit 98d1109

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python_packages/jupyter_lsp/jupyter_lsp/session.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ async def stop_process(self, timeout: int = 5):
206206
if self.process is None: # pragma: no cover
207207
return
208208

209+
if timeout < 0.0: # pragma: no cover
210+
raise ValueError("Timeout must not be negative!")
211+
209212
# try to stop the process gracefully
210213
self.process.terminate()
211-
with anyio.move_on_after(timeout):
214+
with anyio.move_on_after(timeout + 0.1): # avoid timeout of 0s
212215
self.log.debug("Waiting for process to terminate")
213216
await self.process.wait()
214217
return

0 commit comments

Comments
 (0)