Skip to content

Commit

Permalink
sandbox: make Wait() be aware of grpc disconnection
Browse files Browse the repository at this point in the history
Signed-off-by: Abel Feng <fshb1988@gmail.com>
  • Loading branch information
f00589305 authored and abel-von committed Sep 14, 2023
1 parent 5813d21 commit 6be323b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions services/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,18 @@ func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
connParams := grpc.ConnectParams{
Backoff: backoffConfig,
}
retryPolicy := `{
"methodConfig": [{
"name": [{"service": "containerd.services.sandbox.v1.Controller", "method": "Wait"}],
"waitForReady": true,
"retryPolicy": {
"MaxAttempts": 10000,
"InitialBackoff": ".1s",
"MaxBackoff": "10s",
"BackoffMultiplier": 2.0,
"RetryableStatusCodes": [ "UNAVAILABLE" ]
}
}]}`
gopts := []grpc.DialOption{
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithConnectParams(connParams),
Expand All @@ -476,6 +488,7 @@ func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
// TODO(stevvooe): We may need to allow configuration of this on the client.
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(defaults.DefaultMaxSendMsgSize)),
grpc.WithDefaultServiceConfig(retryPolicy),
}

conn, err := grpc.Dial(dialer.DialAddress(address), gopts...)
Expand Down

0 comments on commit 6be323b

Please sign in to comment.