mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
SMGeneric using cloning for replication to avoid concurrency
This commit is contained in:
@@ -597,3 +597,7 @@ func testOnStorITCacheAlias(t *testing.T) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", als, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
func testOnStorITCacheResourceLimit(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
@@ -450,7 +450,10 @@ func (smg *SMGeneric) replicateSessions(cgrID string) (err error) {
|
||||
return
|
||||
}
|
||||
smg.aSessionsMux.RLock()
|
||||
aSessions := smg.activeSessions[cgrID]
|
||||
var aSessions []*SMGSession
|
||||
if err = utils.Clone(smg.activeSessions[cgrID], &aSessions); err != nil {
|
||||
return
|
||||
}
|
||||
smg.aSessionsMux.RUnlock()
|
||||
var wg sync.WaitGroup
|
||||
for _, rplConn := range smg.smgReplConns {
|
||||
|
||||
@@ -630,6 +630,15 @@ func TestClone(t *testing.T) {
|
||||
if b != a {
|
||||
t.Error("Expected:", a, ", received:", b)
|
||||
}
|
||||
// Clone from an interface
|
||||
c := "mystr"
|
||||
ifaceC := interface{}(c)
|
||||
clndIface := reflect.Indirect(reflect.New(reflect.TypeOf(ifaceC))).Interface().(string)
|
||||
if err := Clone(ifaceC, &clndIface); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(ifaceC, clndIface) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", ifaceC, clndIface)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIntPointer(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user