Skip to content

Commit 987e2ae

Browse files
authored
Don't yield in tight loop when context process hasn't started (#5011)
1 parent a81caf6 commit 987e2ae

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix pointless busy loop in Amazon Q wasting CPU cycles (#5000)"
4+
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import kotlinx.coroutines.delay
2121
import kotlinx.coroutines.launch
2222
import kotlinx.coroutines.runBlocking
2323
import kotlinx.coroutines.withTimeout
24-
import kotlinx.coroutines.yield
2524
import software.aws.toolkits.core.utils.debug
2625
import software.aws.toolkits.core.utils.error
2726
import software.aws.toolkits.core.utils.getLogger
@@ -48,14 +47,15 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
4847
return@launch
4948
}
5049

50+
// TODO: need better solution for this
51+
@Suppress("LoopWithTooManyJumpStatements")
5152
while (true) {
5253
if (encoderServer.isNodeProcessRunning()) {
53-
// TODO: need better solution for this
5454
delay(10000)
5555
initAndIndex()
5656
break
5757
} else {
58-
yield()
58+
delay(10000)
5959
}
6060
}
6161
}

0 commit comments

Comments
 (0)