diff --git a/.changes/next-release/bugfix-9e482571-c40a-42d3-906e-ceab1d6440b1.json b/.changes/next-release/bugfix-9e482571-c40a-42d3-906e-ceab1d6440b1.json new file mode 100644 index 00000000000..d450498aced --- /dev/null +++ b/.changes/next-release/bugfix-9e482571-c40a-42d3-906e-ceab1d6440b1.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Adjust resource requirement for starting workspace indexing" +} \ No newline at end of file diff --git a/.changes/next-release/bugfix-de10b7d3-8c8a-4968-88cb-ed28ce3a553e.json b/.changes/next-release/bugfix-de10b7d3-8c8a-4968-88cb-ed28ce3a553e.json new file mode 100644 index 00000000000..1c00b0e3f21 --- /dev/null +++ b/.changes/next-release/bugfix-de10b7d3-8c8a-4968-88cb-ed28ce3a553e.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Fix workspace index process quits when hitting a race condition" +} \ No newline at end of file diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/startup/AmazonQStartupActivity.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/startup/AmazonQStartupActivity.kt index f3995104fd1..2bd06681b23 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/startup/AmazonQStartupActivity.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/startup/AmazonQStartupActivity.kt @@ -63,7 +63,7 @@ class AmazonQStartupActivity : ProjectActivity { } private suspend fun startLsp(project: Project) { - // Automatically start the project context LSP after some delay when average CPU load is below 30%. + // Automatically start the project context LSP after some delay when average CPU load is below 40%. // The CPU load requirement is to avoid competing with native JetBrains indexing and other CPU expensive OS processes // In the future we will decouple LSP start and indexing start to let LSP perform other tasks. val startLspIndexingDuration = Duration.ofMinutes(30) @@ -73,18 +73,19 @@ class AmazonQStartupActivity : ProjectActivity { withTimeout(startLspIndexingDuration) { while (true) { val cpuUsage = ManagementFactory.getOperatingSystemMXBean().systemLoadAverage - if (cpuUsage > 0 && cpuUsage < 30) { + if (cpuUsage > 0 && cpuUsage < 40) { ProjectContextController.getInstance(project = project) break } else { + LOG.warn { "Current CPU usage is $cpuUsage, waiting for it to be below 40% to start LSP server" } delay(60_000) // Wait for 60 seconds } } } } catch (e: TimeoutCancellationException) { - LOG.warn { "Failed to start LSP server due to time out" } + LOG.warn { "Failed to start LSP server due to not enough resource" } } catch (e: Exception) { - LOG.warn { "Failed to start LSP server" } + LOG.warn { "Failed to start LSP server ${e.message}" } } } diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/manifest/ManifestManager.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/manifest/ManifestManager.kt index 52b95acf976..69eb7ddf78f 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/manifest/ManifestManager.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/manifest/ManifestManager.kt @@ -15,7 +15,7 @@ import software.aws.toolkits.jetbrains.core.getTextFromUrl class ManifestManager { private val cloudFrontUrl = "https://aws-toolkit-language-servers.amazonaws.com/q-context/manifest.json" - val currentVersion = "0.1.46" + val currentVersion = "0.1.49" val currentOs = getOs() private val arch = CpuArch.CURRENT private val mapper = jacksonObjectMapper()