mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
Merge branch 'master' of https://github.com/cgrates/cgrates
This commit is contained in:
@@ -56,6 +56,7 @@ type TpReader struct {
|
||||
resProfiles map[string]*utils.TPResource
|
||||
stats map[string]*utils.TPStats
|
||||
thresholds map[string]*utils.TPThreshold
|
||||
resources []string // IDs of resources which need creation based on resourceConfigs
|
||||
|
||||
revDests,
|
||||
revAliases,
|
||||
@@ -1602,6 +1603,13 @@ func (tpr *TpReader) LoadResourceProfilesFiltered(tag string) error {
|
||||
mapRsPs[rl.ID] = rl
|
||||
}
|
||||
tpr.resProfiles = mapRsPs
|
||||
for rID := range mapRsPs {
|
||||
if has, err := tpr.dataStorage.HasData(utils.ResourcesPrefix, rID); err != nil {
|
||||
return err
|
||||
} else if !has {
|
||||
tpr.resources = append(tpr.resources, rID)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1948,6 +1956,17 @@ func (tpr *TpReader) WriteToDatabase(flush, verbose, disable_reverse bool) (err
|
||||
log.Print("\t", rsp.ID)
|
||||
}
|
||||
}
|
||||
if verbose {
|
||||
log.Print("Resources:")
|
||||
}
|
||||
for _, rID := range tpr.resources {
|
||||
if err = tpr.dataStorage.SetResource(&Resource{ID: rID, Usages: make(map[string]*ResourceUsage)}); err != nil {
|
||||
return
|
||||
}
|
||||
if verbose {
|
||||
log.Print("\t", rID)
|
||||
}
|
||||
}
|
||||
if verbose {
|
||||
log.Print("StatQueueProfiles:")
|
||||
}
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
gen=$?
|
||||
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=offline_tp'
|
||||
go test github.com/cgrates/cgrates/apier/v1 -tags=offline_tp
|
||||
ap1=$?
|
||||
|
||||
exit $gen && $ap1
|
||||
|
||||
exit $gen
|
||||
|
||||
Reference in New Issue
Block a user