diff --git a/dispatchers/dispatchers.go b/dispatchers/dispatchers.go index 19385ab6f..03efc16b8 100644 --- a/dispatchers/dispatchers.go +++ b/dispatchers/dispatchers.go @@ -225,6 +225,7 @@ func (dS *DispatcherService) Dispatch(ctx *context.Context, ev *utils.CGREvent, for k, v := range dspLoopAPIOpts { ev.APIOpts[k] = v // dispatcher loop protection opts } + 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) { @@ -232,6 +233,8 @@ func (dS *DispatcherService) Dispatch(ctx *context.Context, ev *utils.CGREvent, } } } + } + if err != nil { // did not dispatch properly, fail-back to standard dispatching utils.Logger.Warning(fmt.Sprintf("<%s> error <%s> using cached routing for dR %+v, continuing with normal dispatching", utils.DispatcherS, err.Error(), dR)) diff --git a/dispatchers/libdispatcher.go b/dispatchers/libdispatcher.go index 65c0a0c77..11130bfc3 100644 --- a/dispatchers/libdispatcher.go +++ b/dispatchers/libdispatcher.go @@ -475,7 +475,12 @@ func callDH(ctx *context.Context, GroupIDs: []string{utils.ConcatenatedKey(utils.CacheDispatcherProfiles, dR.Tenant, dR.ProfileID)}, } if err = engine.Cache.SetWithReplicate(ctx, argsCache); err != nil { - return + if !rpcclient.IsNetworkError(err) { + return + } + // did not dispatch properly, fail-back to standard dispatching + utils.Logger.Warning(fmt.Sprintf("<%s> ignoring cache network error <%s> setting route dR %+v", + utils.DispatcherS, err.Error(), dR)) } } var conn birpc.ClientConnector diff --git a/engine/caches.go b/engine/caches.go index 177cc2ccd..a6391fba4 100644 --- a/engine/caches.go +++ b/engine/caches.go @@ -210,9 +210,9 @@ func (chS *CacheS) GetWithRemote(ctx *context.Context, args *utils.ArgsGetCacheI return } // item was not found locally, query from remote - var itmRemote interface{} if err = chS.connMgr.Call(ctx, chS.cfg.CacheCfg().RemoteConns, - utils.CacheSv1GetItem, args, &itmRemote); err != nil && err.Error() == utils.ErrNotFound.Error() { + utils.CacheSv1GetItem, args, &itm); err != nil && + err.Error() == utils.ErrNotFound.Error() { return nil, utils.ErrNotFound // correct the error coming as string type } return diff --git a/go.mod b/go.mod index b8cd3aece..237d77819 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c 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-20220913172751-83a289e994d7 + github.com/cgrates/rpcclient v0.0.0-20220922181803-b3ddc74ad65a github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e github.com/cgrates/ugocodec v0.0.0-20201023092048-df93d0123f60 github.com/creack/pty v1.1.18 diff --git a/go.sum b/go.sum index c7fd389cc..96e98fa02 100644 --- a/go.sum +++ b/go.sum @@ -141,6 +141,8 @@ github.com/cgrates/rpcclient v0.0.0-20220527094114-95a7ccc07e77 h1:hZGvmvqP4lHyX github.com/cgrates/rpcclient v0.0.0-20220527094114-95a7ccc07e77/go.mod h1:kiM7YHZXmhgKZ0q80qRl0yYFDnTxihTdQYtvQPDeGlM= github.com/cgrates/rpcclient v0.0.0-20220913172751-83a289e994d7 h1:aTeVpeMMJ/vGK4ErqitwczBlVUv49x8M30X9JNcEz94= github.com/cgrates/rpcclient v0.0.0-20220913172751-83a289e994d7/go.mod h1:+Ed0GFdz/rsSY/trWo+k0NFtAi3VP1l3CngZcRSErdw= +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/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/cgrates/ugocodec v0.0.0-20201023092048-df93d0123f60 h1:TQDg+HGB17LU8FitLiLvYazYSy62GQ1lO3lGKI3xUrU=