mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] IJPL-234877 Use default dispatchers for RPC calls
All IO work is actually done by the RPC logic outside the caller context. So, there is no need to use IO for calls. (cherry picked from commit 9838d2fc580b1574d0aa61fd5a01f8a25f9c6038) IJ-CR-194211 GitOrigin-RevId: 7c7a2be52e626367c3cf47861cacaa3e8c5cd7bd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cc6351b890
commit
e7dcee7064
+7
-9
@@ -48,15 +48,13 @@ internal fun updateBackendTabNameOnTitleChange(
|
||||
scope: CoroutineScope,
|
||||
) {
|
||||
title.addListener(scope) {
|
||||
withContext(Dispatchers.IO) {
|
||||
durable {
|
||||
TerminalTabsManagerApi.getInstance().renameTerminalTab(
|
||||
project.projectId(),
|
||||
backendTabId,
|
||||
it.text,
|
||||
it.isUserDefined
|
||||
)
|
||||
}
|
||||
durable {
|
||||
TerminalTabsManagerApi.getInstance().renameTerminalTab(
|
||||
project.projectId(),
|
||||
backendTabId,
|
||||
it.text,
|
||||
it.isUserDefined
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -258,7 +258,7 @@ internal class TerminalToolWindowTabsManagerImpl(
|
||||
private fun createBackendTabAndStartSession(
|
||||
terminal: TerminalViewImpl,
|
||||
builder: TerminalToolWindowTabBuilderImpl,
|
||||
) = terminal.coroutineScope.launch(Dispatchers.IO) {
|
||||
) = terminal.coroutineScope.launch {
|
||||
val backendTabId = builder.backendTabId ?: durable {
|
||||
// todo: worth making it idempotent to avoid creating multiple tabs because of network issues
|
||||
TerminalTabsManagerApi.getInstance().createNewTerminalTab(project.projectId()).id
|
||||
@@ -273,7 +273,7 @@ internal class TerminalToolWindowTabsManagerImpl(
|
||||
val isProjectClosing = getToolWindow().contentManager.isDisposed
|
||||
if (!isProjectClosing) {
|
||||
// Do not block frontend terminal scope cancellation by backend session termination request.
|
||||
coroutineScope.launch(Dispatchers.IO) {
|
||||
coroutineScope.launch {
|
||||
durable {
|
||||
TerminalTabsManagerApi.getInstance().closeTerminalTab(project.projectId(), backendTabId)
|
||||
}
|
||||
@@ -315,7 +315,7 @@ internal class TerminalToolWindowTabsManagerImpl(
|
||||
builder: TerminalToolWindowTabBuilderImpl,
|
||||
backendTabId: Int,
|
||||
calculateSizeFromComponent: Boolean,
|
||||
) = terminal.coroutineScope.launch(Dispatchers.IO) {
|
||||
) = terminal.coroutineScope.launch {
|
||||
if (builder.sessionId != null) {
|
||||
// Session is already started for this tab, reuse it
|
||||
connectSessionToTerminal(terminal, builder.sessionId!!, builder.portForwardingId)
|
||||
@@ -403,7 +403,7 @@ internal class TerminalToolWindowTabsManagerImpl(
|
||||
}
|
||||
|
||||
private fun scheduleTabsRestoring(manager: TerminalToolWindowTabsManagerImpl) {
|
||||
manager.tabsRestoredDeferred = manager.coroutineScope.async(Dispatchers.IO) {
|
||||
manager.tabsRestoredDeferred = manager.coroutineScope.async {
|
||||
val tabs: List<TerminalSessionTab> = durable {
|
||||
TerminalTabsManagerApi.getInstance().getTerminalTabs(manager.project.projectId())
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ internal class TerminalInput(
|
||||
)
|
||||
|
||||
private val inputChannelDeferred: Deferred<SendChannel<TerminalInputEvent>> =
|
||||
coroutineScope.async(Dispatchers.IO + CoroutineName("Get input channel")) {
|
||||
coroutineScope.async(CoroutineName("Get input channel")) {
|
||||
terminalSessionFuture.await().getInputChannel()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ internal class TerminalSessionController(
|
||||
private val edtContext = Dispatchers.EDT + ModalityState.any().asContextElement()
|
||||
|
||||
fun handleEvents(session: TerminalSession) {
|
||||
coroutineScope.launch(Dispatchers.IO + CoroutineName("Output flow collection")) {
|
||||
coroutineScope.launch(CoroutineName("Output flow collection")) {
|
||||
// Get output flow again even if it was terminated.
|
||||
// It can happen in case of RemDev if there were any connection problems and backend decided to terminate the flow.
|
||||
while (!session.isClosed) {
|
||||
|
||||
+1
-1
@@ -378,7 +378,7 @@ class TerminalViewImpl(
|
||||
|
||||
override suspend fun hasChildProcesses(): Boolean {
|
||||
val session = sessionFuture.getNow(null) ?: return false
|
||||
return withContext(Dispatchers.IO) {
|
||||
return withContext(Dispatchers.Default) {
|
||||
session.hasRunningCommands()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user