Elffuss BraidHub

kikocis/continue public

fix: restart on background
Changeset5d6825a019b3e68a5b5efb6feebf25daf94279e870c28c03495420baf26efd07
AuthorJakub Blach <jakubblach@gmail.com> · 2025-07-08 16:53 +02:00
CommitterJakub Blach <jakubblach@gmail.com> · 2025-07-08 16:53 +02:00
Parents95206ce5cf3c

Browse the files at this changeset

2 files changed

modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt +12 −8
@@ -7,6 +7,8 @@
77 import com.intellij.openapi.diagnostic.Logger
88 import com.intellij.openapi.project.Project
99 import kotlinx.coroutines.CoroutineScope
10+import kotlinx.coroutines.delay
11+import kotlinx.coroutines.launch
1012
1113 class CoreMessengerManager(
1214 private val project: Project,
@@ -22,14 +24,16 @@
2224 }
2325
2426 fun restart() {
25- try {
26- coreMessenger.killSubProcess()
27- lastBackoffInterval *= 2
28- log.warn("Continue process exited, retrying in $lastBackoffInterval seconds")
29- Thread.sleep((lastBackoffInterval * 1000).toLong())
30- coreMessenger = createCoreMessenger()
31- } catch (e: Exception) {
32- service<TelemetryService>().capture("jetbrains_core_start_error", mapOf("error" to e))
27+ coroutineScope.launch {
28+ try {
29+ coreMessenger.killSubProcess()
30+ lastBackoffInterval *= 2
31+ log.warn("Continue process exited, retrying in $lastBackoffInterval seconds")
32+ delay((lastBackoffInterval * 1000).toLong())
33+ coreMessenger = createCoreMessenger()
34+ } catch (e: Exception) {
35+ service<TelemetryService>().capture("jetbrains_core_start_error", mapOf("error" to e))
36+ }
3337 }
3438 }
3539
modified extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/ContinueProcessHandlerTest.kt +2 −2
@@ -23,7 +23,7 @@
2323
2424 handler.close()
2525
26- // assert all message lines are present (order not important)
26+ // assert all message lines are present (order is not important)
2727 val lines = process.string.split("\r\n").filter { it.isNotBlank() }
2828 for (i in 0..100)
2929 Assertions.assertTrue(lines.contains("message number $i"))
@@ -48,4 +48,4 @@
4848 override fun close() {
4949 }
5050 }
51-}
No newline at the end of the file
51+}