diff --git a/.changes/next-release/bugfix-b18a6b61-e1e9-42dd-952d-7c32ea7a3a19.json b/.changes/next-release/bugfix-b18a6b61-e1e9-42dd-952d-7c32ea7a3a19.json new file mode 100644 index 0000000000..40a96a0e10 --- /dev/null +++ b/.changes/next-release/bugfix-b18a6b61-e1e9-42dd-952d-7c32ea7a3a19.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Fix pointless busy loop in Amazon Q wasting CPU cycles (#5000)" +} diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt index bf82e0bcdf..2a3f4a19e4 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt @@ -21,7 +21,6 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withTimeout -import kotlinx.coroutines.yield import software.aws.toolkits.core.utils.debug import software.aws.toolkits.core.utils.error import software.aws.toolkits.core.utils.getLogger @@ -48,14 +47,15 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En return@launch } + // TODO: need better solution for this + @Suppress("LoopWithTooManyJumpStatements") while (true) { if (encoderServer.isNodeProcessRunning()) { - // TODO: need better solution for this delay(10000) initAndIndex() break } else { - yield() + delay(10000) } } }