mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-27 23:09:08 +01:00
[client] increase gRPC health check timeout to 5s (#5961)
Bump the IsHealthy() context timeout from 1s to 5s for both the management and signal gRPC clients to reduce false negatives on slower or congested connections.
This commit is contained in:
@@ -30,6 +30,8 @@ import (
|
|||||||
|
|
||||||
const ConnectTimeout = 10 * time.Second
|
const ConnectTimeout = 10 * time.Second
|
||||||
|
|
||||||
|
const healthCheckTimeout = 5 * time.Second
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// EnvMaxRecvMsgSize overrides the default gRPC max receive message size (4 MB)
|
// EnvMaxRecvMsgSize overrides the default gRPC max receive message size (4 MB)
|
||||||
// for the management client connection. Value is in bytes.
|
// for the management client connection. Value is in bytes.
|
||||||
@@ -532,7 +534,7 @@ func (c *GrpcClient) IsHealthy() bool {
|
|||||||
case connectivity.Ready:
|
case connectivity.Ready:
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(c.ctx, 1*time.Second)
|
ctx, cancel := context.WithTimeout(c.ctx, healthCheckTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := c.realClient.GetServerKey(ctx, &proto.Empty{})
|
_, err := c.realClient.GetServerKey(ctx, &proto.Empty{})
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import (
|
|||||||
"github.com/netbirdio/netbird/util/wsproxy"
|
"github.com/netbirdio/netbird/util/wsproxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const healthCheckTimeout = 5 * time.Second
|
||||||
|
|
||||||
// ConnStateNotifier is a wrapper interface of the status recorder
|
// ConnStateNotifier is a wrapper interface of the status recorder
|
||||||
type ConnStateNotifier interface {
|
type ConnStateNotifier interface {
|
||||||
MarkSignalDisconnected(error)
|
MarkSignalDisconnected(error)
|
||||||
@@ -263,7 +265,7 @@ func (c *GrpcClient) IsHealthy() bool {
|
|||||||
case connectivity.Ready:
|
case connectivity.Ready:
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(c.ctx, 1*time.Second)
|
ctx, cancel := context.WithTimeout(c.ctx, healthCheckTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, err := c.realClient.Send(ctx, &proto.EncryptedMessage{
|
_, err := c.realClient.Send(ctx, &proto.EncryptedMessage{
|
||||||
Key: c.key.PublicKey().String(),
|
Key: c.key.PublicKey().String(),
|
||||||
|
|||||||
Reference in New Issue
Block a user