mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-26 22:39:07 +01:00
increase grpc timeouts
This commit is contained in:
@@ -272,9 +272,9 @@ func (c *GrpcClient) GetServerPublicKey() (*wgtypes.Key, error) {
|
|||||||
return nil, errors.New(errMsgNoMgmtConnection)
|
return nil, errors.New(errMsgNoMgmtConnection)
|
||||||
}
|
}
|
||||||
|
|
||||||
mgmCtx, cancel := context.WithTimeout(c.ctx, 30*time.Second)
|
// mgmCtx, cancel := context.WithTimeout(c.ctx, 30*time.Second)
|
||||||
defer cancel()
|
// defer cancel()
|
||||||
resp, err := c.realClient.GetServerKey(mgmCtx, &proto.Empty{})
|
resp, err := c.realClient.GetServerKey(c.ctx, &proto.Empty{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failed while getting Management Service public key: %v", err)
|
log.Errorf("failed while getting Management Service public key: %v", err)
|
||||||
return nil, fmt.Errorf("failed while getting Management Service public key")
|
return nil, fmt.Errorf("failed while getting Management Service public key")
|
||||||
@@ -327,11 +327,9 @@ func (c *GrpcClient) login(serverKey wgtypes.Key, req *proto.LoginRequest) (*pro
|
|||||||
|
|
||||||
var resp *proto.EncryptedMessage
|
var resp *proto.EncryptedMessage
|
||||||
operation := func() error {
|
operation := func() error {
|
||||||
mgmCtx, cancel := context.WithTimeout(context.Background(), ConnectTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
resp, err = c.realClient.Login(mgmCtx, &proto.EncryptedMessage{
|
resp, err = c.realClient.Login(context.Background(), &proto.EncryptedMessage{
|
||||||
WgPubKey: c.key.PublicKey().String(),
|
WgPubKey: c.key.PublicKey().String(),
|
||||||
Body: loginReq,
|
Body: loginReq,
|
||||||
})
|
})
|
||||||
|
|||||||
+3
-6
@@ -71,18 +71,15 @@ func CreateConnection(addr string, tlsEnabled bool) (*grpc.ClientConn, error) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
connCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
conn, err := grpc.DialContext(
|
conn, err := grpc.DialContext(
|
||||||
connCtx,
|
context.Background(),
|
||||||
addr,
|
addr,
|
||||||
transportOption,
|
transportOption,
|
||||||
WithCustomDialer(),
|
WithCustomDialer(),
|
||||||
grpc.WithBlock(),
|
grpc.WithBlock(),
|
||||||
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
Time: 30 * time.Second,
|
Time: 10 * time.Minute,
|
||||||
Timeout: 10 * time.Second,
|
Timeout: 5 * time.Minute,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user