Skip to content

Commit

Permalink
adding timeout for RPC call
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-hurley committed Jul 29, 2024
1 parent a2d0687 commit f34478f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"regexp"
"strings"
"sync"
"time"

"github.com/go-logr/logr"
"github.com/konveyor/analyzer-lsp/jsonrpc2"
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit f34478f

Please sign in to comment.