File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -172,9 +172,21 @@ def pylsp_lint(
172172 log .info ("executing mypy args = %s" , args )
173173 report , errors , _ = mypy_api .run (args )
174174 else :
175+ # If dmypy daemon is non-responsive calls to run will block.
176+ # Check daemon status, if non-zero daemon is dead or hung.
177+ # If daemon is hung, kill will reset
178+ # If daemon is dead/absent, kill will no-op.
179+ # In either case, reset to fresh state
180+ _ , _err , _status = mypy_api .run_dmypy (["status" ])
181+ if _status != 0 :
182+ log .info (
183+ "restarting dmypy from status: %s message: %s" , _status , _err .strip ()
184+ )
185+ mypy_api .run_dmypy (["kill" ])
186+
187+ # run to use existing daemon or restart if required
175188 args = ["run" , "--" ] + args
176-
177- log .info ("executing dmypy args = %s" , args )
189+ log .info ("dmypy run args = %s" , args )
178190 report , errors , _ = mypy_api .run_dmypy (args )
179191
180192 log .debug ("report:\n %s" , report )
You can’t perform that action at this time.
0 commit comments