renamed newservice2 function to newservicewithping

This commit is contained in:
gezimbll
2024-06-07 10:45:32 -04:00
committed by Dan Christian Bogos
parent 009895f92a
commit 27c4242c52
7 changed files with 7 additions and 7 deletions

View File

@@ -148,7 +148,7 @@ func (s RPCClientSet) Call(ctx *context.Context, method string, args any, reply
func NewService(val any) (_ IntService, err error) {
return NewServiceWithName(val, utils.EmptyString, false)
}
func NewService2(val any, name, prefix string) (*birpc.Service, error) {
func NewServiceWithPing(val any, name, prefix string) (*birpc.Service, error) {
srv, err := birpc.NewServiceWithMethodsRename(val, name, true, func(funcName string) string {
return strings.TrimPrefix(funcName, prefix)
})

View File

@@ -103,7 +103,7 @@ func (acts *AccountService) Start(ctx *context.Context, _ context.CancelFunc) (e
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.AccountS))
srv, err := engine.NewService2(acts.acts, utils.AccountSv1, utils.V1Prfx)
srv, err := engine.NewServiceWithPing(acts.acts, utils.AccountSv1, utils.V1Prfx)
if err != nil {
return err
}

View File

@@ -101,7 +101,7 @@ func (acts *ActionService) Start(ctx *context.Context, _ context.CancelFunc) (er
go acts.acts.ListenAndServe(acts.stopChan, acts.rldChan)
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.ActionS))
srv, err := engine.NewService2(acts.acts, utils.ActionSv1, utils.V1Prfx)
srv, err := engine.NewServiceWithPing(acts.acts, utils.ActionSv1, utils.V1Prfx)
if err != nil {
return
}

View File

@@ -100,7 +100,7 @@ func (cdrSrv *CDRService) Start(ctx *context.Context, _ context.CancelFunc) (err
go cdrSrv.cdrS.ListenAndServe(cdrSrv.stopChan)
runtime.Gosched()
utils.Logger.Info("Registering CDRS RPC service.")
srv, err := engine.NewService2(cdrSrv.cdrS, utils.CDRsV1, utils.V1Prfx)
srv, err := engine.NewServiceWithPing(cdrSrv.cdrS, utils.CDRsV1, utils.V1Prfx)
if err != nil {
return err
}

View File

@@ -121,7 +121,7 @@ func (es *EventExporterService) Start(ctx *context.Context, _ context.CancelFunc
es.stopChan = make(chan struct{})
go es.eeS.ListenAndServe(es.stopChan, es.rldChan)
srv, _ := engine.NewService2(es.eeS, utils.EeSv1, utils.V1Prfx)
srv, _ := engine.NewServiceWithPing(es.eeS, utils.EeSv1, utils.V1Prfx)
// srv, _ := birpc.NewService(es.rpc, "", false)
if !es.cfg.DispatcherSCfg().Enabled {
es.server.RpcRegister(srv)

View File

@@ -69,7 +69,7 @@ func (efServ *ExportFailoverService) Start(ctx *context.Context, _ context.Cance
efServ.efS = efs.NewEfs(efServ.cfg, efServ.connMgr)
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.EFs))
efServ.stopChan = make(chan struct{})
efServ.srv, _ = engine.NewService2(efServ.efS, utils.EfSv1, utils.V1Prfx)
efServ.srv, _ = engine.NewServiceWithPing(efServ.efS, utils.EfSv1, utils.V1Prfx)
efServ.server.RpcRegister(efServ.srv)
efServ.Unlock()
return

View File

@@ -134,7 +134,7 @@ func (rs *RateService) Start(ctx *context.Context, _ context.CancelFunc) (err er
rs.stopChan = make(chan struct{})
go rs.rateS.ListenAndServe(rs.stopChan, rs.rldChan)
srv, err := engine.NewService2(rs.rateS, utils.RateSv1, utils.V1Prfx)
srv, err := engine.NewServiceWithPing(rs.rateS, utils.RateSv1, utils.V1Prfx)
if err != nil {
return err
}