mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-19 07:54:46 +00:00
fix: grpc timeouts
This commit is contained in:
parent
28a03c5db2
commit
064a4f320c
4 changed files with 21 additions and 8 deletions
|
|
@ -6,13 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.6.6-233] - 2025-10-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- gRPC request timeouts during autocompletion and next-edits
|
||||
|
||||
## [3.6.5-233] - 2025-10-22
|
||||
## [3.6.5-241.1] - 2025-10-22
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
|||
|
|
@ -40,9 +40,17 @@ class CodeCompletionStreamObserver(
|
|||
|
||||
override fun onError(t: Throwable?) {
|
||||
logger.error("Error occurred while fetching code completion", t)
|
||||
if (t is StatusRuntimeException && t.status.code != Status.Code.UNAVAILABLE) {
|
||||
if (t is StatusRuntimeException) {
|
||||
val code = t.status.code
|
||||
if (code != Status.Code.UNAVAILABLE && code != Status.Code.DEADLINE_EXCEEDED) {
|
||||
OverlayUtil.showNotification(
|
||||
t.message ?: "Something went wrong",
|
||||
NotificationType.ERROR
|
||||
)
|
||||
}
|
||||
} else {
|
||||
OverlayUtil.showNotification(
|
||||
t.message ?: "Something went wrong",
|
||||
t?.message ?: "Something went wrong",
|
||||
NotificationType.ERROR
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ class GrpcClientService(private val project: Project) : Disposable {
|
|||
|
||||
val grpcRequest = createCodeCompletionGrpcRequest(request)
|
||||
codeCompletionObserver = CodeCompletionStreamObserver(channel, eventListener)
|
||||
codeCompletionStub?.getCodeCompletion(grpcRequest, codeCompletionObserver)
|
||||
codeCompletionStub
|
||||
?.withDeadlineAfter(300, TimeUnit.SECONDS)
|
||||
?.getCodeCompletion(grpcRequest, codeCompletionObserver)
|
||||
}
|
||||
|
||||
fun getNextEdit(
|
||||
|
|
@ -73,7 +75,9 @@ class GrpcClientService(private val project: Project) : Disposable {
|
|||
|
||||
val request = createNextEditGrpcRequest(editor, fileContent, caretOffset)
|
||||
nextEditStreamObserver = NextEditStreamObserver(editor, addToQueue) { dispose() }
|
||||
nextEditStub?.nextEdit(request, nextEditStreamObserver)
|
||||
nextEditStub
|
||||
?.withDeadlineAfter(300, TimeUnit.SECONDS)
|
||||
?.nextEdit(request, nextEditStreamObserver)
|
||||
}
|
||||
|
||||
fun acceptEdit(responseId: UUID, acceptedEdit: String) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ class NextEditStreamObserver(
|
|||
|
||||
try {
|
||||
if (ex is StatusRuntimeException) {
|
||||
if (ex.status.code == Status.Code.DEADLINE_EXCEEDED) {
|
||||
return
|
||||
}
|
||||
OverlayUtil.showNotification(
|
||||
ex.status.description ?: ex.localizedMessage,
|
||||
NotificationType.ERROR,
|
||||
|
|
@ -73,4 +76,4 @@ class NextEditStreamObserver(
|
|||
override fun onCompleted() {
|
||||
editor.project?.let { CompletionProgressNotifier.update(it, false) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue