Update rpcclient library to latest version

Replace all instances of rpcclient.ClientConnector with birpc.ClientConnector.

Pass context, maxReconnectInterval, delayFunc and birpcClient to rpcclient
constructors.

Remove redundant time.Duration conversions (e.g. time.Duration(1*time.Second)
now becomes time.Second.

Add context where needed (context.Background() for tests, context.TODO()
for places where it should be passed from somewhere else).

Implement that functionality of the SessionSv1.Sleep call, in sessions/sessions
instead of apier/v1.

Make changes in utils/server.go (replacing the old rpc2 library with github.com/cgrates/birpc).

Change the way we register birpc methods for sessions in services, using a helper function
defined in engine/libengine.go.
This commit is contained in:
ionutboangiu
2023-03-30 11:27:15 -04:00
committed by Dan Christian Bogos
parent 0560fa63f8
commit cb7ea790de
94 changed files with 767 additions and 687 deletions

View File

@@ -26,9 +26,9 @@ import (
"reflect"
"testing"
"github.com/cgrates/birpc"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
var (
@@ -97,9 +97,9 @@ func testLoaderITInitDataDB(t *testing.T) {
if err = dbConn.Flush(utils.EmptyString); err != nil {
t.Fatal("Error when flushing datadb")
}
cacheChan := make(chan rpcclient.ClientConnector, 1)
cacheChan := make(chan birpc.ClientConnector, 1)
cacheChan <- NewCacheS(lCfg, dataDbCsv)
connMgr = NewConnManager(lCfg, map[string]chan rpcclient.ClientConnector{
connMgr = NewConnManager(lCfg, map[string]chan birpc.ClientConnector{
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches): cacheChan,
})
}