From 9d2c0d7e81eb01198049ec9a666172f4b4bd377f Mon Sep 17 00:00:00 2001 From: Anastasia Katsman Date: Tue, 2 Jan 2024 12:18:38 +0100 Subject: [PATCH] [rdct-tests]: use setSuspendPreserveClientId with Dispatchers.Default Scheduler for cases when clientId is not critical GitOrigin-RevId: bf788057a52b62d7d6f17e3dd84f6daa2de3bcc0 --- .../remoteDev/tests/impl/DistributedTestHost.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platform/remoteDev-util/src/com/intellij/remoteDev/tests/impl/DistributedTestHost.kt b/platform/remoteDev-util/src/com/intellij/remoteDev/tests/impl/DistributedTestHost.kt index 5611c50e321a..8b5b1f27fece 100644 --- a/platform/remoteDev-util/src/com/intellij/remoteDev/tests/impl/DistributedTestHost.kt +++ b/platform/remoteDev-util/src/com/intellij/remoteDev/tests/impl/DistributedTestHost.kt @@ -194,8 +194,9 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) { } } } - - session.isResponding.setSuspendPreserveClientId { _, _ -> + // actually doesn't really preserve clientId, not really important here + // https://youtrack.jetbrains.com/issue/RDCT-653/setSuspendPreserveClientId-with-custom-dispatcher-doesnt-preserve-ClientId + session.isResponding.setSuspendPreserveClientId(handlerScheduler = Dispatchers.Default.asRdScheduler) { _, _ -> LOG.info("Answering for session is responding...") true } @@ -218,13 +219,17 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) { } } - session.requestFocus.setSuspendPreserveClientId { _, actionTitle -> - withContext(Dispatchers.EDT) { + // actually doesn't really preserve clientId, not really important here + // https://youtrack.jetbrains.com/issue/RDCT-653/setSuspendPreserveClientId-with-custom-dispatcher-doesnt-preserve-ClientId + session.requestFocus.setSuspendPreserveClientId(handlerScheduler = Dispatchers.Default.asRdScheduler) { _, actionTitle -> + withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) { requestFocus(actionTitle) } } - session.makeScreenshot.setSuspendPreserveClientId { _, fileName -> + // actually doesn't really preserve clientId, not really important here + // https://youtrack.jetbrains.com/issue/RDCT-653/setSuspendPreserveClientId-with-custom-dispatcher-doesnt-preserve-ClientId + session.makeScreenshot.setSuspendPreserveClientId(handlerScheduler = Dispatchers.Default.asRdScheduler) { _, fileName -> makeScreenshot(fileName) }