diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a23d8cd..dfbee00d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- gRPC request timeouts during autocompletion and next-edits + ## [3.6.5-233] - 2025-10-22 ### Added diff --git a/src/main/kotlin/ee/carlrobert/codegpt/codecompletions/edit/GrpcClientService.kt b/src/main/kotlin/ee/carlrobert/codegpt/codecompletions/edit/GrpcClientService.kt index 849b2cc0..5e6171c3 100644 --- a/src/main/kotlin/ee/carlrobert/codegpt/codecompletions/edit/GrpcClientService.kt +++ b/src/main/kotlin/ee/carlrobert/codegpt/codecompletions/edit/GrpcClientService.kt @@ -24,6 +24,7 @@ import ee.carlrobert.service.* import io.grpc.ManagedChannel import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder +import io.grpc.netty.shaded.io.netty.channel.ChannelOption import kotlinx.coroutines.channels.ProducerScope import java.util.concurrent.TimeUnit @@ -118,6 +119,7 @@ class GrpcClientService(private val project: Project) : Disposable { if (codeCompletionStub == null) { codeCompletionStub = CodeCompletionServiceImplGrpc.newStub(channel) .withCallCredentials(createCallCredentials()) + .withDeadlineAfter(300, TimeUnit.SECONDS) } } @@ -128,6 +130,7 @@ class GrpcClientService(private val project: Project) : Disposable { if (nextEditStub == null) { nextEditStub = NextEditServiceImplGrpc.newStub(channel) .withCallCredentials(createCallCredentials()) + .withDeadlineAfter(300, TimeUnit.SECONDS) } } @@ -161,6 +164,12 @@ class GrpcClientService(private val project: Project) : Disposable { .trustManager(CertificateManager.getInstance().trustManager) .build() ) + .withOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) + .keepAliveTime(30, TimeUnit.SECONDS) + .keepAliveTimeout(10, TimeUnit.SECONDS) + .keepAliveWithoutCalls(true) + .idleTimeout(5, TimeUnit.MINUTES) + .maxInboundMessageSize(32 * 1024 * 1024) .build() private fun ensureActiveChannel() {