mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 06:38:45 +05:00
RPCClient with lazyConnect
This commit is contained in:
@@ -109,7 +109,8 @@ func main() {
|
||||
return
|
||||
}
|
||||
var err error
|
||||
client, err = rpcclient.NewRpcClient("tcp", *server, 3, 3, time.Duration(1*time.Second), time.Duration(5*time.Minute), *rpc_encoding, nil)
|
||||
client, err = rpcclient.NewRpcClient("tcp", *server, 3, 3,
|
||||
time.Duration(1*time.Second), time.Duration(5*time.Minute), *rpc_encoding, nil, false)
|
||||
if err != nil {
|
||||
flag.PrintDefaults()
|
||||
log.Fatal("Could not connect to server " + *server)
|
||||
|
||||
@@ -153,7 +153,7 @@ func startSmGeneric(internalSMGChan chan *sessionmanager.SMGeneric, internalRate
|
||||
smgReplConns := make([]*sessionmanager.SMGReplicationConn, len(cfg.SmGenericConfig.SMGReplicationConns))
|
||||
for i, replConnCfg := range cfg.SmGenericConfig.SMGReplicationConns {
|
||||
if replCon, err := rpcclient.NewRpcClient("tcp", replConnCfg.Address, cfg.ConnectAttempts, cfg.Reconnects,
|
||||
cfg.ConnectTimeout, cfg.ReplyTimeout, replConnCfg.Transport[1:], nil); err != nil {
|
||||
cfg.ConnectTimeout, cfg.ReplyTimeout, replConnCfg.Transport[1:], nil, true); err != nil {
|
||||
utils.Logger.Crit(fmt.Sprintf("<SMGeneric> Could not connect to SMGReplicationConn: <%s>, error: <%s>", replConnCfg.Address, err.Error()))
|
||||
exitChan <- true
|
||||
return
|
||||
|
||||
@@ -299,7 +299,8 @@ func main() {
|
||||
return
|
||||
}
|
||||
if *historyServer != "" { // Init scribeAgent so we can store the differences
|
||||
if scribeAgent, err := rpcclient.NewRpcClient("tcp", *historyServer, 3, 3, time.Duration(1*time.Second), time.Duration(5*time.Minute), utils.GOB, nil); err != nil {
|
||||
if scribeAgent, err := rpcclient.NewRpcClient("tcp", *historyServer, 3, 3,
|
||||
time.Duration(1*time.Second), time.Duration(5*time.Minute), utils.GOB, nil, false); err != nil {
|
||||
log.Fatalf("Could not connect to history server, error: %s. Make sure you have properly configured it via -history_server flag.", err.Error())
|
||||
return
|
||||
} else {
|
||||
|
||||
@@ -42,7 +42,8 @@ func main() {
|
||||
if cdrsMasterCfg, err = config.NewCGRConfigFromFolder(cdrsMasterCfgPath); err != nil {
|
||||
log.Fatal("Got config error: ", err.Error())
|
||||
}
|
||||
cdrsMasterRpc, err = rpcclient.NewRpcClient("tcp", cdrsMasterCfg.RPCJSONListen, 1, 1, time.Duration(1*time.Second), time.Duration(2*time.Second), "json", nil)
|
||||
cdrsMasterRpc, err = rpcclient.NewRpcClient("tcp", cdrsMasterCfg.RPCJSONListen, 1, 1,
|
||||
time.Duration(1*time.Second), time.Duration(2*time.Second), "json", nil, false)
|
||||
if err != nil {
|
||||
log.Fatal("Could not connect to rater: ", err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user