From bb2845ebda82447154f55867dc756cc71b765bfd Mon Sep 17 00:00:00 2001 From: TeoV Date: Thu, 12 Dec 2019 13:26:00 +0200 Subject: [PATCH] Implement the failover mechanish to ConnManager --- engine/connmanager.go | 6 +++++- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/engine/connmanager.go b/engine/connmanager.go index 0611c22be..bd4bef37a 100644 --- a/engine/connmanager.go +++ b/engine/connmanager.go @@ -95,7 +95,11 @@ func (cM *ConnManager) Call(connIDs []string, biRPCClient rpcclient.ClientConnec if conn, err = cM.getConn(connID, biRPCClient); err != nil { continue } - return conn.Call(method, arg, reply) + if err = conn.Call(method, arg, reply); rpcclient.IsNetworkError(err) { + continue + } else { + return + } } return } diff --git a/go.mod b/go.mod index b781a9eae..065b97d09 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/cgrates/kamevapi v0.0.0-20191001125829-7dbc3ad58817 github.com/cgrates/ltcache v0.0.0-20181016092649-92fb7fa77cca github.com/cgrates/radigo v0.0.0-20181207143118-e5c8f3272ccc - github.com/cgrates/rpcclient v0.0.0-20191209100218-70f91dc30ac6 + github.com/cgrates/rpcclient v0.0.0-20191212101551-ff9c136f66a7 github.com/creack/pty v1.1.7 github.com/fiorix/go-diameter v3.0.3-0.20190716165154-f4823472d0e0+incompatible github.com/fortytw2/leaktest v1.3.0 // indirect diff --git a/go.sum b/go.sum index 5a9ffc607..c7f90ea12 100644 --- a/go.sum +++ b/go.sum @@ -71,6 +71,8 @@ github.com/cgrates/rpcclient v0.0.0-20191115092211-732f09b356e3 h1:Hr038ZfPZz87O github.com/cgrates/rpcclient v0.0.0-20191115092211-732f09b356e3/go.mod h1:Jy5Lv0y57OlxlNATKrkyAxgftYLHqXuxONgd4qsAC1U= github.com/cgrates/rpcclient v0.0.0-20191209100218-70f91dc30ac6 h1:g1LZmbYvqYkGAxM4/bNfTcBooCFf0lK2mgrp3yZERL0= github.com/cgrates/rpcclient v0.0.0-20191209100218-70f91dc30ac6/go.mod h1:xXLqAKVvcdWeDYwHJYwDgAI3ZOg5LZYxzb72kLjsLZU= +github.com/cgrates/rpcclient v0.0.0-20191212101551-ff9c136f66a7 h1:szJPaMz/49gP0X6M1DhjhImDP3rLN8ul7rio2tzorNc= +github.com/cgrates/rpcclient v0.0.0-20191212101551-ff9c136f66a7/go.mod h1:xXLqAKVvcdWeDYwHJYwDgAI3ZOg5LZYxzb72kLjsLZU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=