mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 21:59:53 +05:00
Fix merge problems
This commit is contained in:
committed by
Dan Christian Bogos
parent
827503ce60
commit
f3c137f195
@@ -92,9 +92,9 @@ func testTPActionTriggersInitCfg(t *testing.T) {
|
||||
config.SetCgrConfig(tpActionTriggerCfg)
|
||||
switch tpActionTriggerConfigDIR {
|
||||
case "tutmongo": // Mongo needs more time to reset db, need to investigate
|
||||
tpActionDelay = 2000
|
||||
tpActionTriggerDelay = 2000
|
||||
default:
|
||||
tpActionDelay = 1000
|
||||
tpActionTriggerDelay = 1000
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ const (
|
||||
colCpp = "charger_profiles"
|
||||
colDpp = "dispatcher_profiles"
|
||||
colDph = "dispatcher_hosts"
|
||||
colLID = "load_ids"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -2189,3 +2190,37 @@ func (ms *MongoStorage) RemoveDispatcherHostDrv(tenant, id string) (err error) {
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func (ms *MongoStorage) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]string, err error) {
|
||||
fop := options.FindOne()
|
||||
if itemIDPrefix != "" {
|
||||
fop.SetProjection(bson.M{itemIDPrefix: 1, "_id": 0})
|
||||
} else {
|
||||
fop.SetProjection(bson.M{"_id": 0})
|
||||
}
|
||||
if err = ms.query(func(sctx mongo.SessionContext) (err error) {
|
||||
cur := ms.getCol(colLID).FindOne(sctx, bson.D{}, fop)
|
||||
if err := cur.Decode(&loadIDs); err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
return utils.ErrNotFound
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(loadIDs) == 0 {
|
||||
return nil, utils.ErrNotFound
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (ms *MongoStorage) SetLoadIDsDrv(loadIDs map[string]string) (err error) {
|
||||
return ms.query(func(sctx mongo.SessionContext) (err error) {
|
||||
_, err = ms.getCol(colLID).UpdateOne(sctx, bson.D{}, bson.M{"$set": loadIDs},
|
||||
options.Update().SetUpsert(true),
|
||||
)
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user