mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 07:08:45 +05:00
Storage.mongo - fix GetLCR
This commit is contained in:
@@ -965,8 +965,8 @@ func testOnStorITCRUDLCR(t *testing.T) {
|
||||
Tenant: "cgrates.org",
|
||||
Category: "call",
|
||||
Direction: "*out",
|
||||
Account: "*any",
|
||||
Subject: "*any",
|
||||
Account: "testOnStorITCRUDLCR",
|
||||
Subject: "testOnStorITCRUDLCR",
|
||||
Activations: []*LCRActivation{
|
||||
&LCRActivation{
|
||||
ActivationTime: time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC).Local(),
|
||||
@@ -989,21 +989,18 @@ func testOnStorITCRUDLCR(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
/*FixMe @Edwardo22
|
||||
|
||||
if _, rcvErr := onStor.GetLCR(lcr.GetId(), true, utils.NonTransactional); rcvErr != utils.ErrNotFound {
|
||||
t.Error(rcvErr)
|
||||
}
|
||||
*/
|
||||
if err := onStor.SetLCR(lcr, utils.NonTransactional); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
/*FixMe @Edwardo22
|
||||
if rcv, err := onStor.GetLCR(lcr.GetId(), true, utils.NonTransactional); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(lcr, rcv) {
|
||||
t.Errorf("Expecting: %v, received: %v", lcr, rcv) //rcv nil
|
||||
t.Errorf("Expecting: %v, received: %v", lcr, rcv)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
func testOnStorITCRUDCdrStats(t *testing.T) {
|
||||
|
||||
@@ -791,12 +791,13 @@ func (ms *MongoStorage) GetLCR(key string, skipCache bool, transactionID string)
|
||||
cCommit := cacheCommit(transactionID)
|
||||
if err = col.Find(bson.M{"key": key}).One(&result); err != nil {
|
||||
if err == mgo.ErrNotFound {
|
||||
cache.Set(cacheKey, nil, cacheCommit(transactionID), transactionID)
|
||||
cache.Set(cacheKey, nil, cCommit, transactionID)
|
||||
err = utils.ErrNotFound
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
cache.Set(cacheKey, result.Value, cCommit, transactionID)
|
||||
lcr = result.Value
|
||||
cache.Set(cacheKey, lcr, cCommit, transactionID)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user