mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update rpcclient revising error handling
This commit is contained in:
committed by
Dan Christian Bogos
parent
79f824c575
commit
ac96e53c43
@@ -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.IsNetworkError(err) {
|
||||
serviceMethod, args, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(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.IsNetworkError(err) {
|
||||
serviceMethod, args, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ 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.IsNetworkError(err)) { // successful dispatch with normal errors
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err)) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
@@ -332,7 +332,7 @@ func (ld *loadDispatcher) Dispatch(dm *engine.DataManager, flts *engine.FilterS,
|
||||
lM.decrementLoad(ctx, dR.HostID, ld.tntID) // call ended
|
||||
if err == nil ||
|
||||
(err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsNetworkError(err)) { // successful dispatch with normal errors
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err)) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
// not found or network errors will continue with standard dispatching
|
||||
@@ -360,7 +360,7 @@ func (ld *loadDispatcher) Dispatch(dm *engine.DataManager, flts *engine.FilterS,
|
||||
lM.decrementLoad(ctx, hostID, ld.tntID) // call ended
|
||||
if err == nil ||
|
||||
(err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsNetworkError(err)) { // successful dispatch with normal errors
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err)) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
@@ -478,7 +478,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.IsNetworkError(err) {
|
||||
if !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(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.IsNetworkError(err) {
|
||||
if err = conn.Call(ctx, method, arg, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(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.IsNetworkError(err) {
|
||||
if err = conn.Call(ctx, method, arg, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
8
go.mod
8
go.mod
@@ -1,8 +1,6 @@
|
||||
module github.com/cgrates/cgrates
|
||||
|
||||
go 1.22
|
||||
|
||||
toolchain go1.22.0
|
||||
go 1.22.4
|
||||
|
||||
// replace github.com/cgrates/radigo => ../radigo
|
||||
|
||||
@@ -21,7 +19,7 @@ require (
|
||||
github.com/cgrates/kamevapi v0.0.0-20240307160311-26273f03eedf
|
||||
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab
|
||||
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627
|
||||
github.com/cgrates/rpcclient v0.0.0-20220922181803-b3ddc74ad65a
|
||||
github.com/cgrates/rpcclient v0.0.0-20240628101047-cb29aae6b006
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e
|
||||
github.com/creack/pty v1.1.20
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
@@ -74,7 +72,7 @@ require (
|
||||
github.com/blevesearch/zap/v13 v13.0.6 // indirect
|
||||
github.com/blevesearch/zap/v14 v14.0.5 // indirect
|
||||
github.com/blevesearch/zap/v15 v15.0.3 // indirect
|
||||
github.com/cenkalti/hub v1.0.1 // indirect
|
||||
github.com/cenkalti/hub v1.0.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/couchbase/ghistogram v0.1.0 // indirect
|
||||
github.com/couchbase/moss v0.1.0 // indirect
|
||||
|
||||
8
go.sum
8
go.sum
@@ -40,10 +40,10 @@ github.com/blevesearch/zap/v14 v14.0.5 h1:NdcT+81Nvmp2zL+NhwSvGSLh7xNgGL8QRVZ67n
|
||||
github.com/blevesearch/zap/v14 v14.0.5/go.mod h1:bWe8S7tRrSBTIaZ6cLRbgNH4TUDaC9LZSpRGs85AsGY=
|
||||
github.com/blevesearch/zap/v15 v15.0.3 h1:Ylj8Oe+mo0P25tr9iLPp33lN6d4qcztGjaIsP51UxaY=
|
||||
github.com/blevesearch/zap/v15 v15.0.3/go.mod h1:iuwQrImsh1WjWJ0Ue2kBqY83a0rFtJTqfa9fp1rbVVU=
|
||||
github.com/cenk/hub v1.0.1 h1:RBwXNOF4a8KjD8BJ08XqN8KbrqaGiQLDrgvUGJSHuPA=
|
||||
github.com/cenk/hub v1.0.1/go.mod h1:rJM1LNAW0ppT8FMMuPK6c2NP/R2nH/UthtuRySSaf6Y=
|
||||
github.com/cenkalti/hub v1.0.1 h1:UMtjc6dHSaOQTO15SVA50MBIR9zQwvsukQupDrkIRtg=
|
||||
github.com/cenkalti/hub v1.0.1/go.mod h1:tcYwtS3a2d9NO/0xDXVJWx3IedurUjYCqFCmpi0lpHs=
|
||||
github.com/cenkalti/hub v1.0.2 h1:Nqv9TNaA9boeO2wQFW8o87BY3zKthtnzXmWGmJqhAV8=
|
||||
github.com/cenkalti/hub v1.0.2/go.mod h1:8LAFAZcCasb83vfxatMUnZHRoQcffho2ELpHb+kaTJU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
@@ -63,8 +63,8 @@ github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab h1:dKdAUwrij6vYwew
|
||||
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab/go.mod h1:9oSG/6gUoab/vKm/eQ3QcX6KeTR0wRw88N33iCnC/k4=
|
||||
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627 h1:foxHlpQxYj15khhlpbj+EiIM/W9Gk0HP800NQ/DVPpU=
|
||||
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627/go.mod h1:PizDxlLTjVQpyPU0ksWYfmM9UbYGu7q6at0nzuiZprI=
|
||||
github.com/cgrates/rpcclient v0.0.0-20220922181803-b3ddc74ad65a h1:eZKp/pqv46latOHmyeMOHpAukERoG76qyzx2l74l+1I=
|
||||
github.com/cgrates/rpcclient v0.0.0-20220922181803-b3ddc74ad65a/go.mod h1:+Ed0GFdz/rsSY/trWo+k0NFtAi3VP1l3CngZcRSErdw=
|
||||
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/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