Skip to content

Commit

Permalink
Peer info for UI: Add context timeout in endpoint (#2361)
Browse files Browse the repository at this point in the history
The edit peer button does not appear in the case where we run into
connection timeouts when connecting to Postgres - as we hit a 1 minute
gateway timeout in the UI
This PR sets a 30 second timeout on the endpoint to get peer info so
that the endpoint errors out faster and the edit peer button is shown

Ideally we would decouple the edit button from this endpoint entirely
though
  • Loading branch information
Amogh-Bharadwaj authored Dec 23, 2024
1 parent 863e237 commit af75526
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flow/cmd/peer_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af75526

Please sign in to comment.