mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore(e2e): increase ucind cluster init timeouts, decrease max backoff delay for TCP connection to retry faster
This commit is contained in:
@@ -4,10 +4,12 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/grpcversion"
|
||||
"golang.org/x/net/proxy"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/backoff"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
@@ -21,10 +23,19 @@ func NewTCPConnector(apiAddr netip.AddrPort) *TCPConnector {
|
||||
}
|
||||
|
||||
func (c *TCPConnector) Connect(_ context.Context) (*grpc.ClientConn, error) {
|
||||
// Use a faster connection backoff than the default (which grows up to 120s). TCP connections are typically to
|
||||
// local Docker containers (ucind) or LAN machines where long backoff delays are unnecessary.
|
||||
backoffConfig := backoff.DefaultConfig
|
||||
backoffConfig.MaxDelay = 5 * time.Second
|
||||
|
||||
conn, err := grpc.NewClient(
|
||||
c.apiAddr.String(),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
grpc.WithDefaultServiceConfig(defaultServiceConfig),
|
||||
grpc.WithConnectParams(grpc.ConnectParams{
|
||||
Backoff: backoffConfig,
|
||||
MinConnectTimeout: 5 * time.Second,
|
||||
}),
|
||||
grpc.WithUnaryInterceptor(grpcversion.ClientUnaryInterceptor),
|
||||
grpc.WithStreamInterceptor(grpcversion.ClientStreamInterceptor),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user