Skip to content

Commit f0f8029

Browse files
authored
fix(ch): validatePeer increase timeout (#3545)
1 parent f241a1a commit f0f8029

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

flow/cmd/validate_peer.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ func (h *FlowRequestHandler) ValidatePeer(
1414
ctx context.Context,
1515
req *protos.ValidatePeerRequest,
1616
) (*protos.ValidatePeerResponse, APIError) {
17-
ctx, cancelCtx := context.WithTimeout(ctx, 15*time.Second)
18-
defer cancelCtx()
1917
if req.Peer == nil {
2018
return &protos.ValidatePeerResponse{
2119
Status: protos.ValidatePeerStatus_INVALID,
@@ -30,6 +28,15 @@ func (h *FlowRequestHandler) ValidatePeer(
3028
}, NewInvalidArgumentApiError(errors.New("no peer name provided"))
3129
}
3230

31+
validatePeerDeadline := 15 * time.Second
32+
if req.Peer.Type == protos.DBType_CLICKHOUSE {
33+
// if instance is overloaded, DDL can take longer than 15s to execute
34+
validatePeerDeadline = 1 * time.Minute
35+
}
36+
37+
ctx, cancelCtx := context.WithTimeout(ctx, validatePeerDeadline)
38+
defer cancelCtx()
39+
3340
conn, err := connectors.GetConnector(ctx, nil, req.Peer)
3441
if err != nil {
3542
displayErr := fmt.Errorf("%s peer %s was invalidated: %w", req.Peer.Type, req.Peer.Name, err)

0 commit comments

Comments
 (0)