From 65e9d107eeea5e594f46f88e6b47afc3a743e6b5 Mon Sep 17 00:00:00 2001 From: Shawn Hurley Date: Mon, 29 Jul 2024 14:13:30 -0400 Subject: [PATCH] adding timeout for RPC call Signed-off-by: Shawn Hurley --- .../pkg/java_external_provider/service_client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/external-providers/java-external-provider/pkg/java_external_provider/service_client.go b/external-providers/java-external-provider/pkg/java_external_provider/service_client.go index ff01ca02..f3d8d2f8 100644 --- a/external-providers/java-external-provider/pkg/java_external_provider/service_client.go +++ b/external-providers/java-external-provider/pkg/java_external_provider/service_client.go @@ -11,6 +11,7 @@ import ( "regexp" "strings" "sync" + "time" "github.com/go-logr/logr" "github.com/konveyor/analyzer-lsp/jsonrpc2" @@ -137,7 +138,9 @@ func (p *javaServiceClient) GetAllSymbols(ctx context.Context, query, location s } var refs []protocol.WorkspaceSymbol - err := p.rpc.Call(ctx, "workspace/executeCommand", wsp, &refs) + // If it takes us 5min to complete a request, then we are in trouble + timeOutCtx, _ := context.WithTimeout(ctx, 5*time.Minute) + err := p.rpc.Call(timeOutCtx, "workspace/executeCommand", wsp, &refs) if err != nil { if jsonrpc2.IsRPCClosed(err) { p.log.Error(err, "connection to the language server is closed, language server is not running")