diff --git a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java index eae7776a7140..68162b7e8901 100644 --- a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java +++ b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java @@ -36,6 +36,7 @@ import static com.jetbrains.python.debugger.pydev.transport.BaseDebuggerTranspor public class RemoteDebugger implements ProcessDebugger { private static final int RESPONSE_TIMEOUT = 60000; + private static final int SHORT_TIMEOUT = 2000; private static final Logger LOG = Logger.getInstance("#com.jetbrains.python.pydev.remote.RemoteDebugger"); @@ -339,8 +340,7 @@ public class RemoteDebugger implements ProcessDebugger { return myDebuggerTransport.isConnecting() || myDebuggerTransport.isConnected(); } - @Override - public void execute(@NotNull final AbstractCommand command) { + public void execute(@NotNull final AbstractCommand command, int responseTimeout) { CountDownLatch myLatch = new CountDownLatch(1); ApplicationManager.getApplication().executeOnPooledThread(() -> { if (command instanceof ResumeOrStepCommand) { @@ -361,7 +361,7 @@ public class RemoteDebugger implements ProcessDebugger { if (command.isResponseExpected()) { // Note: do not wait for result from UI thread try { - myLatch.await(RESPONSE_TIMEOUT, TimeUnit.MILLISECONDS); + myLatch.await(responseTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // restore interrupted flag @@ -372,6 +372,11 @@ public class RemoteDebugger implements ProcessDebugger { } } + @Override + public void execute(@NotNull final AbstractCommand command) { + execute(command, RESPONSE_TIMEOUT); + } + boolean sendFrame(final ProtocolFrame frame) { return myDebuggerTransport.sendFrame(frame); } @@ -674,14 +679,14 @@ public class RemoteDebugger implements ProcessDebugger { @Override public List getCompletions(String threadId, String frameId, String prefix) { final GetCompletionsCommand command = new GetCompletionsCommand(this, threadId, frameId, prefix); - execute(command); + execute(command, SHORT_TIMEOUT); return command.getCompletions(); } @Override public String getDescription(String threadId, String frameId, String cmd) { final GetDescriptionCommand command = new GetDescriptionCommand(this, threadId, frameId, cmd); - execute(command); + execute(command, SHORT_TIMEOUT); return command.getResult(); }