Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package io.gitpod.jetbrains.remote

import com.intellij.codeWithMe.ClientId
import com.intellij.codeWithMe.asContextElement
import com.intellij.ide.BrowserUtil
import com.intellij.ide.CommandLineProcessor
import com.intellij.openapi.client.ClientKind
Expand All @@ -27,10 +28,7 @@ import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.http.FullHttpRequest
import io.netty.handler.codec.http.QueryStringDecoder
import io.prometheus.client.exporter.common.TextFormat
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.*
import org.jetbrains.ide.RestService
import org.jetbrains.io.response
import java.io.OutputStreamWriter
Expand Down Expand Up @@ -113,14 +111,12 @@ class GitpodCLIService : RestService() {
}

private fun withClient(request: FullHttpRequest, context: ChannelHandlerContext, action: suspend (project: Project?) -> Unit): String? {
GlobalScope.launch {
getClientSessionAndProjectAsync().let { (session, project) ->
ClientId.withClientId(session.clientId) {
runBlocking {
action(project)
}
sendOk(request, context)
}
val scope = CoroutineScope(Dispatchers.Default)
scope.launch {
val (session, project) = getClientSessionAndProjectAsync()
withContext(session.clientId.asContextElement()) {
action(project)
sendOk(request, context)
}
}
return null
Expand Down
Loading