mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
engine using pool first strategy
This commit is contained in:
@@ -138,8 +138,8 @@ func startCdrc(internalCdrSChan chan *engine.CdrServer, internalRaterChan chan *
|
||||
|
||||
func startSmGeneric(internalSMGChan chan rpcclient.RpcClientConnection, internalRaterChan chan *engine.Responder, server *utils.Server, exitChan chan bool) {
|
||||
utils.Logger.Info("Starting CGRateS SM-Generic service.")
|
||||
raterConn := &rpcclient.RpcClientPool{}
|
||||
cdrsConn := &rpcclient.RpcClientPool{}
|
||||
raterConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
cdrsConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
var client *rpcclient.RpcClient
|
||||
var err error
|
||||
// Connect to rater
|
||||
@@ -227,8 +227,8 @@ func startDiameterAgent(internalSMGChan chan rpcclient.RpcClientConnection, exit
|
||||
|
||||
func startSmFreeSWITCH(internalRaterChan chan *engine.Responder, cdrDb engine.CdrStorage, exitChan chan bool) {
|
||||
utils.Logger.Info("Starting CGRateS SM-FreeSWITCH service.")
|
||||
raterConn := &rpcclient.RpcClientPool{}
|
||||
cdrsConn := &rpcclient.RpcClientPool{}
|
||||
raterConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
cdrsConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
var client *rpcclient.RpcClient
|
||||
var err error
|
||||
// Connect to rater
|
||||
@@ -277,8 +277,8 @@ func startSmFreeSWITCH(internalRaterChan chan *engine.Responder, cdrDb engine.Cd
|
||||
|
||||
func startSmKamailio(internalRaterChan chan *engine.Responder, cdrDb engine.CdrStorage, exitChan chan bool) {
|
||||
utils.Logger.Info("Starting CGRateS SM-Kamailio service.")
|
||||
raterConn := &rpcclient.RpcClientPool{}
|
||||
cdrsConn := &rpcclient.RpcClientPool{}
|
||||
raterConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
cdrsConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
var client *rpcclient.RpcClient
|
||||
var err error
|
||||
// Connect to rater
|
||||
@@ -327,8 +327,8 @@ func startSmKamailio(internalRaterChan chan *engine.Responder, cdrDb engine.CdrS
|
||||
|
||||
func startSmOpenSIPS(internalRaterChan chan *engine.Responder, cdrDb engine.CdrStorage, exitChan chan bool) {
|
||||
utils.Logger.Info("Starting CGRateS SM-OpenSIPS service.")
|
||||
raterConn := &rpcclient.RpcClientPool{}
|
||||
cdrsConn := &rpcclient.RpcClientPool{}
|
||||
raterConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
cdrsConn := rpcclient.NewRpcClientPool(rpcclient.POOL_FIRST)
|
||||
var client *rpcclient.RpcClient
|
||||
var err error
|
||||
// Connect to rater
|
||||
|
||||
@@ -238,6 +238,7 @@ func startRater(internalRaterChan chan *engine.Responder, internalBalancerChan c
|
||||
}
|
||||
|
||||
responder := &engine.Responder{Bal: bal, ExitChan: exitChan, Stats: cdrStats}
|
||||
responder.SetTimeToLive(cfg.ResponseCacheTTL)
|
||||
apierRpcV1 := &v1.ApierV1{StorDb: loadDb, RatingDb: ratingDb, AccountDb: accountDb, CdrDb: cdrDb, LogDb: logDb, Sched: sched,
|
||||
Config: cfg, Responder: responder, CdrStatsSrv: cdrStats, Users: userServer}
|
||||
apierRpcV2 := &v2.ApierV2{
|
||||
|
||||
@@ -57,12 +57,8 @@ type Responder struct {
|
||||
responseCache *cache2go.ResponseCache
|
||||
}
|
||||
|
||||
func NewResponder(exitChan chan bool, cdrSrv *CdrServer, stats rpcclient.RpcClientConnection, timeToLive time.Duration) *Responder {
|
||||
return &Responder{
|
||||
ExitChan: exitChan,
|
||||
Stats: stats,
|
||||
responseCache: cache2go.NewResponseCache(timeToLive),
|
||||
}
|
||||
func (rs *Responder) SetTimeToLive(timeToLive time.Duration) {
|
||||
rs.responseCache = cache2go.NewResponseCache(timeToLive)
|
||||
}
|
||||
|
||||
func (rs *Responder) getCache() *cache2go.ResponseCache {
|
||||
|
||||
Reference in New Issue
Block a user