From eb38d396dbc07a52d8fff232562c869bb6a29735 Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Mon, 16 Dec 2024 21:43:33 +0530 Subject: [PATCH] add context timeout --- flow/cmd/peer_data.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flow/cmd/peer_data.go b/flow/cmd/peer_data.go index cc41f6ef2..b82107501 100644 --- a/flow/cmd/peer_data.go +++ b/flow/cmd/peer_data.go @@ -82,6 +82,8 @@ func (h *FlowRequestHandler) GetPeerInfo( ctx context.Context, req *protos.PeerInfoRequest, ) (*protos.PeerInfoResponse, error) { + ctx, cancelCtx := context.WithTimeout(ctx, 30*time.Second) + defer cancelCtx() peer, err := connectors.LoadPeer(ctx, h.pool, req.PeerName) if err != nil { return nil, err