internal/jsonrpc2_v2: eliminate most arbitrary timeouts in tests

For golang/go#46047
For golang/go#49387
For golang/go#46520

Change-Id: Ib72863a024d74f45c70a6cb53482cb606510f7e4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/388598
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2022-03-01 15:17:42 -05:00 • committed by Gopher Robot
commit 8db5747d28

View file

@ -11,7 +11,6 @@ import (
"path"
"reflect"
"testing"
"time"
"golang.org/x/tools/internal/event/export/eventtest"
"github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2"
@ -370,8 +369,6 @@ func (h *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (interface{
return true, nil
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(time.Second):
return nil, fmt.Errorf("wait for %q timed out", name)
}
case "fork":
var name string
@ -385,8 +382,6 @@ func (h *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (interface{
h.conn.Respond(req.ID, true, nil)
case <-ctx.Done():
h.conn.Respond(req.ID, nil, ctx.Err())
case <-time.After(time.Second):
h.conn.Respond(req.ID, nil, fmt.Errorf("wait for %q timed out", name))
}
}()
return nil, jsonrpc2.ErrAsyncResponse