Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Fix a bug when Amazon Q responds with still indexing message even when `@workspace` index is done"
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
)
}

private fun setConnectionTimeout(connection: HttpURLConnection) {
connection.connectTimeout = 5000 // 5 seconds
connection.readTimeout = 5000 // 5 second
private fun setConnectionTimeout(connection: HttpURLConnection, timeout: Int) {
connection.connectTimeout = timeout
connection.readTimeout = timeout
}

private fun setConnectionProperties(connection: HttpURLConnection) {
Expand Down Expand Up @@ -310,10 +310,11 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
private fun sendMsgToLsp(msgType: LspMessage, request: String?): LspResponse {
logger.info { "sending message: ${msgType.endpoint} to lsp on port ${encoderServer.port}" }
val url = URL("http://localhost:${encoderServer.port}/${msgType.endpoint}")

// use 1h as timeout for index, 5 seconds for other APIs
val timeoutMs = if (msgType is LspMessage.Index) 3600*1000 else 5000
return with(url.openConnection() as HttpURLConnection) {
setConnectionProperties(this)
setConnectionTimeout(this)
setConnectionTimeout(this, timeoutMs)
request?.let { r ->
setConnectionRequest(this, r)
}
Expand Down
Loading