mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
update rpcclient library (#4413)
for more details: https://github.com/cgrates/rpcclient/pull/37
This commit is contained in:
committed by
Dan Christian Bogos
parent
abba61723a
commit
6474c1076f
@@ -269,7 +269,7 @@ func (dS *DispatcherService) Dispatch(ev *utils.CGREvent, subsys string,
|
||||
ev.APIOpts[k] = v // dispatcher loop protection opts
|
||||
}
|
||||
if err = d.Dispatch(dS.dm, dS.fltrS, 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
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ func (dS *DispatcherService) Dispatch(ev *utils.CGREvent, subsys string,
|
||||
Tenant: dPrfl.Tenant,
|
||||
ProfileID: dPrfl.ID,
|
||||
},
|
||||
serviceMethod, args, reply); !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
serviceMethod, args, reply); !rpcclient.ShouldFailover(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,9 +229,8 @@ func (sd *singleResultDispatcher) Dispatch(dm *engine.DataManager, flts *engine.
|
||||
}
|
||||
}
|
||||
if err = callDHwithID(tnt, hostID, routeID, dRh, dm,
|
||||
serviceMethod, args, reply); err == nil ||
|
||||
(err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err)) { // successful dispatch with normal errors
|
||||
serviceMethod, args, reply); err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.ShouldFailover(err) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
@@ -314,10 +313,8 @@ func (ld *loadDispatcher) Dispatch(dm *engine.DataManager, flts *engine.FilterS,
|
||||
lM.incrementLoad(dR.HostID, ld.tntID)
|
||||
err = callDHwithID(tnt, dR.HostID, routeID, dR, dm,
|
||||
serviceMethod, args, reply)
|
||||
lM.decrementLoad(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(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
|
||||
@@ -342,10 +339,8 @@ func (ld *loadDispatcher) Dispatch(dm *engine.DataManager, flts *engine.FilterS,
|
||||
lM.incrementLoad(hostID, ld.tntID)
|
||||
err = callDHwithID(tnt, hostID, routeID, dRh, dm,
|
||||
serviceMethod, args, reply)
|
||||
lM.decrementLoad(hostID, ld.tntID) // call ended
|
||||
if err == nil ||
|
||||
(err != utils.ErrDSPHostNotFound &&
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err)) { // successful dispatch with normal errors
|
||||
lM.decrementLoad(hostID, ld.tntID) // call ended
|
||||
if err != utils.ErrDSPHostNotFound && !rpcclient.ShouldFailover(err) { // successful dispatch with normal errors
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
@@ -457,7 +452,7 @@ func callDH(dh *engine.DispatcherHost, routeID string, dR *DispatcherRoute,
|
||||
GroupIDs: []string{utils.ConcatenatedKey(utils.CacheDispatcherProfiles, dR.Tenant, dR.ProfileID)},
|
||||
}
|
||||
if err = engine.Cache.SetWithReplicate(argsCache); err != nil {
|
||||
if !rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
if !rpcclient.ShouldFailover(err) {
|
||||
return
|
||||
}
|
||||
// did not dispatch properly, fail-back to standard dispatching
|
||||
|
||||
@@ -194,8 +194,7 @@ func testDspResponderBroadcast(t *testing.T) {
|
||||
allEngine.stopEngine(t)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
pingReply = ""
|
||||
if err := dispEngine.RPC.Call(context.Background(), utils.ResponderPing, pingEv, &pingReply); err == nil ||
|
||||
!rpcclient.IsConnectionErr(err) && !rpcclient.IsServiceErr(err) {
|
||||
if err := dispEngine.RPC.Call(context.Background(), utils.ResponderPing, pingEv, &pingReply); !rpcclient.ShouldFailover(err) {
|
||||
t.Errorf("Expected error: %s received error: %v and reply %q", utils.ErrPartiallyExecuted.Error(), err, pingReply)
|
||||
}
|
||||
allEngine.startEngine(t)
|
||||
|
||||
Reference in New Issue
Block a user