Skip to content

Commit 9f0372e

Browse files
committed
fix: use launch instead of withContext for fire-and-forget coroutines
Address PR review feedback to match original invocation semantics. Changed from withContext (which suspends and waits) to launch (fire-and-forget) for: - Publishing environment started notification - Stopping environment and reconnecting
1 parent 9048a69 commit 9f0372e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/toolkit/jetbrains-gateway/src/software/aws/toolkits/jetbrains/gateway/CawsConnectionProvider.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import com.jetbrains.rd.util.lifetime.Lifetime
3535
import com.jetbrains.rd.util.lifetime.LifetimeDefinition
3636
import kotlinx.coroutines.CancellationException
3737
import kotlinx.coroutines.coroutineScope
38-
import kotlinx.coroutines.withContext
38+
import kotlinx.coroutines.launch
3939
import org.jetbrains.concurrency.AsyncPromise
4040
import org.jetbrains.concurrency.await
4141
import software.amazon.awssdk.services.codecatalyst.CodeCatalystClient
@@ -199,7 +199,7 @@ class CawsConnectionProvider : GatewayConnectionProvider {
199199
)
200200
}
201201

202-
withContext(getCoroutineBgContext()) {
202+
launch(getCoroutineBgContext()) {
203203
ApplicationManager.getApplication().messageBus.syncPublisher(WorkspaceNotifications.TOPIC)
204204
.environmentStarted(
205205
WorkspaceListStateChangeContext(
@@ -249,7 +249,7 @@ class CawsConnectionProvider : GatewayConnectionProvider {
249249
duration = timeTakenToCheckInstallation.toDouble()
250250
)
251251

252-
withContext(getCoroutineBgContext()) {
252+
launch(getCoroutineBgContext()) {
253253
environmentActions.stopEnvironment()
254254
GatewayUI.getInstance().connect(parameters)
255255
}

0 commit comments

Comments
 (0)