mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-06-26 15:01:32 +02:00
main
- Adding retry policy for mobility
This commit is contained in:
parent
bf53108384
commit
d2c8a52ec6
@ -42,8 +42,25 @@ func NewWgCtrlConnection(clientConfig *tls.Config, server string) (PeerConnectio
|
|||||||
|
|
||||||
// ConnectWithToken: Connects to a new gRPC peer given the address of the other server.
|
// ConnectWithToken: Connects to a new gRPC peer given the address of the other server.
|
||||||
func (c *WgCtrlConnection) CreateGrpcConnection() error {
|
func (c *WgCtrlConnection) CreateGrpcConnection() error {
|
||||||
|
retryPolicy := `{
|
||||||
|
"methodConfig": [{
|
||||||
|
"name": [
|
||||||
|
{"service": "syncservice.SyncService"},
|
||||||
|
{"service": "ctrlserver.MeshCtrlServer"}
|
||||||
|
],
|
||||||
|
"waitForReady": true,
|
||||||
|
"retryPolicy": {
|
||||||
|
"MaxAttempts": 2,
|
||||||
|
"InitialBackoff": ".01s",
|
||||||
|
"MaxBackoff": ".01s",
|
||||||
|
"BackoffMultiplier": 1.0,
|
||||||
|
"RetryableStatusCodes": [ "UNAVAILABLE" ]
|
||||||
|
}
|
||||||
|
}]}`
|
||||||
|
|
||||||
conn, err := grpc.Dial(c.endpoint,
|
conn, err := grpc.Dial(c.endpoint,
|
||||||
grpc.WithTransportCredentials(credentials.NewTLS(c.clientConfig)))
|
grpc.WithTransportCredentials(credentials.NewTLS(c.clientConfig)),
|
||||||
|
grpc.WithDefaultServiceConfig(retryPolicy))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logging.Log.WriteErrorf("Could not connect: %s\n", err.Error())
|
logging.Log.WriteErrorf("Could not connect: %s\n", err.Error())
|
||||||
|
@ -19,7 +19,7 @@ type ConnectionManager interface {
|
|||||||
// If the endpoint does not exist then add the connection. Returns an error
|
// If the endpoint does not exist then add the connection. Returns an error
|
||||||
// if something went wrong
|
// if something went wrong
|
||||||
GetConnection(endPoint string) (PeerConnection, error)
|
GetConnection(endPoint string) (PeerConnection, error)
|
||||||
// HasConnections returns true if a client has already registered at the givne
|
// HasConnections returns true if a peer has already registered at the given
|
||||||
// endpoint or false otherwise.
|
// endpoint or false otherwise.
|
||||||
HasConnection(endPoint string) bool
|
HasConnection(endPoint string) bool
|
||||||
// Goes through all the connections and closes eachone
|
// Goes through all the connections and closes eachone
|
||||||
|
Loading…
x
Reference in New Issue
Block a user