Skip to content

Commit 3357e88

Browse files
authored
fix(amazonq): fix infinite loop when workspace indexing process fails to start (#5581)
1 parent d4a3b27 commit 3357e88

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
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 infinite loop when workspace indexing server fails to initialize"
4+
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,14 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
116116
logger.info { "project context index starting" }
117117
delay(300)
118118
val isIndexSuccess = index()
119-
if (isIndexSuccess) isIndexComplete.set(true)
119+
if (isIndexSuccess) {
120+
isIndexComplete.set(true)
121+
}
120122
return
121123
}
124+
retryCount.incrementAndGet()
122125
} catch (e: Exception) {
126+
logger.warn(e) { "failed to init project context" }
123127
if (e.stackTraceToString().contains("Connection refused")) {
124128
retryCount.incrementAndGet()
125129
delay(10000)
@@ -133,6 +137,7 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
133137
private suspend fun initEncryption(): Boolean {
134138
val request = encoderServer.getEncryptionRequest()
135139
val response = sendMsgToLsp(LspMessage.Initialize, request)
140+
logger.info { "received response to init encryption: $response" }
136141
return response?.responseCode == 200
137142
}
138143

0 commit comments

Comments
 (0)