Skip to content

fix(amazonq): properly handle encode server exception #5585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Expand Up @@ -123,11 +123,19 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
}
retryCount.incrementAndGet()
} catch (e: Exception) {
logger.warn(e) { "failed to init project context" }
if (e.stackTraceToString().contains("Connection refused")) {
retryCount.incrementAndGet()
delay(10000)
if (encoderServer.isNodeProcessRunning()) {
// there is a chance that client throws java.net.ConnectException: Connection refused
// in this case, the server is busy doing tree sitter parsing
// and will be responsive later once it goes past the tree sitter parsing phrase.
// Long term solution is to move encode server to LSP protocol
return
} else {
retryCount.incrementAndGet()
delay(10000)
}
} else {
logger.warn(e) { "failed to init project context" }
return
}
}
Expand Down
Loading