mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 14:48:43 +05:00
update rpcclient library (#4413)
This commit is contained in:
committed by
Dan Christian Bogos
parent
2f387b5a0e
commit
3187bca82e
@@ -225,7 +225,7 @@ func (dS *DispatcherService) Dispatch(ctx *context.Context, ev *utils.CGREvent,
|
||||
}
|
||||
if err = d.Dispatch(dS.dm, dS.fltrS, dS.cfg,
|
||||
ctx, dS.connMgr.GetDispInternalChan(), evNm, tnt, utils.EmptyString, dR,
|
||||
serviceMethod, args, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
serviceMethod, args, reply); !rpcclient.ShouldFailover(err) {
|
||||
return // dispatch success or specific error coming from upstream
|
||||
}
|
||||
}
|
||||
@@ -262,7 +262,7 @@ func (dS *DispatcherService) Dispatch(ctx *context.Context, ev *utils.CGREvent,
|
||||
Tenant: dPrfl.Tenant,
|
||||
ProfileID: dPrfl.ID,
|
||||
},
|
||||
serviceMethod, args, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
serviceMethod, args, reply); !rpcclient.ShouldFailover(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,9 +239,8 @@ func (sd *singleResultDispatcher) Dispatch(dm *engine.DataManager, flts *engine.
|
||||
}
|
||||
}
|
||||
if err = callDHwithID(ctx, tnt, hostID, routeID, dRh, dm,
|
||||
cfg, iPRCCh, serviceMethod, args, reply); err == nil ||
|
||||
err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) { // successful dispatch with normal errors
|
||||
cfg, iPRCCh, serviceMethod, args, reply); err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.ShouldFailover(err) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
@@ -329,10 +328,8 @@ func (ld *loadDispatcher) Dispatch(dm *engine.DataManager, flts *engine.FilterS,
|
||||
lM.incrementLoad(ctx, dR.HostID, ld.tntID)
|
||||
err = callDHwithID(ctx, tnt, dR.HostID, routeID, dR, dm,
|
||||
cfg, iPRCCh, serviceMethod, args, reply)
|
||||
lM.decrementLoad(ctx, dR.HostID, ld.tntID) // call ended
|
||||
if err == nil ||
|
||||
err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) { // successful dispatch with normal errors
|
||||
lM.decrementLoad(ctx, dR.HostID, ld.tntID) // call ended
|
||||
if err != utils.ErrDSPHostNotFound && !rpcclient.ShouldFailover(err) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
// not found or network errors will continue with standard dispatching
|
||||
@@ -357,10 +354,8 @@ func (ld *loadDispatcher) Dispatch(dm *engine.DataManager, flts *engine.FilterS,
|
||||
lM.incrementLoad(ctx, hostID, ld.tntID)
|
||||
err = callDHwithID(ctx, tnt, hostID, routeID, dRh, dm,
|
||||
cfg, iPRCCh, serviceMethod, args, reply)
|
||||
lM.decrementLoad(ctx, hostID, ld.tntID) // call ended
|
||||
if err == nil ||
|
||||
err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) { // successful dispatch with normal errors
|
||||
lM.decrementLoad(ctx, hostID, ld.tntID) // call ended
|
||||
if err != utils.ErrDSPHostNotFound && !rpcclient.ShouldFailover(err) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
@@ -478,7 +473,7 @@ func callDH(ctx *context.Context,
|
||||
GroupIDs: []string{utils.ConcatenatedKey(utils.CacheDispatcherProfiles, dR.Tenant, dR.ProfileID)},
|
||||
}
|
||||
if err = engine.Cache.SetWithReplicate(ctx, argsCache); err != nil {
|
||||
if !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
if !rpcclient.ShouldFailover(err) {
|
||||
return
|
||||
}
|
||||
// did not dispatch properly, fail-back to standard dispatching
|
||||
|
||||
@@ -158,7 +158,7 @@ func (cM *ConnManager) Call(ctx *context.Context, connIDs []string,
|
||||
if conn, err = cM.getConn(ctx, connID); err != nil {
|
||||
continue
|
||||
}
|
||||
if err = conn.Call(ctx, method, arg, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
if err = conn.Call(ctx, method, arg, reply); !rpcclient.ShouldFailover(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ func (cM *ConnManager) CallWithConnIDs(connIDs []string, ctx *context.Context, s
|
||||
if conn, err = cM.getConnWithConfig(ctx, connID, newCfg, nil, false); err != nil {
|
||||
continue
|
||||
}
|
||||
if err = conn.Call(ctx, method, arg, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
if err = conn.Call(ctx, method, arg, reply); !rpcclient.ShouldFailover(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -19,7 +19,7 @@ require (
|
||||
github.com/cgrates/kamevapi v0.0.0-20240307160311-26273f03eedf
|
||||
github.com/cgrates/ltcache v0.0.0-20240411152156-e673692056db
|
||||
github.com/cgrates/radigo v0.0.0-20240123163129-491c899df727
|
||||
github.com/cgrates/rpcclient v0.0.0-20240628101047-cb29aae6b006
|
||||
github.com/cgrates/rpcclient v0.0.0-20240816141816-52dd1074499e
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e
|
||||
github.com/creack/pty v1.1.23
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
|
||||
4
go.sum
4
go.sum
@@ -69,8 +69,8 @@ github.com/cgrates/ltcache v0.0.0-20240411152156-e673692056db h1:JRgzMS5kJ1Wxave
|
||||
github.com/cgrates/ltcache v0.0.0-20240411152156-e673692056db/go.mod h1:jVYq943GCWxhXXxi/1NthN9ATeyFUSbwJRbN/bb+ADQ=
|
||||
github.com/cgrates/radigo v0.0.0-20240123163129-491c899df727 h1:rhYHlbfEPDNreekd1ZtUYi/NbFm5cEl8twQZ3c/0nYU=
|
||||
github.com/cgrates/radigo v0.0.0-20240123163129-491c899df727/go.mod h1:W/5LcOm9jaz0NfIFT09bxjddEai8DTSfw9poqDqtAX4=
|
||||
github.com/cgrates/rpcclient v0.0.0-20240628101047-cb29aae6b006 h1:HxmDpmCesrwbi+ag/4+PDRhuSy0gpemMRQ19fAWmDTE=
|
||||
github.com/cgrates/rpcclient v0.0.0-20240628101047-cb29aae6b006/go.mod h1:WxTEIJvgI4c3eiPWW0WeAhHGd49Oi1Voe9lahotJiNo=
|
||||
github.com/cgrates/rpcclient v0.0.0-20240816141816-52dd1074499e h1:rwvvB0F9WZNmBriZSNo6dbYy1H26yueeLBkuxQMUW0E=
|
||||
github.com/cgrates/rpcclient v0.0.0-20240816141816-52dd1074499e/go.mod h1:WxTEIJvgI4c3eiPWW0WeAhHGd49Oi1Voe9lahotJiNo=
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e h1:izFjZB83/XRXInc+gMIssUxdbleGsGIuGCPj2u7RQo0=
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e/go.mod h1:0f2+3dq5Iiv3VlcuY83VPJ0QzqRlzDG1Cr8okogQE3g=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
|
||||
Reference in New Issue
Block a user