mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 23:58:44 +05:00
some memory profiling and optimization
This commit is contained in:
@@ -266,17 +266,13 @@ func (cd *CallDescriptor) addRatingInfos(ris RatingInfos) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
/*
|
||||
Constructs the key for the storage lookup.
|
||||
The prefixLen is limiting the length of the destination prefix.
|
||||
*/
|
||||
// Constructs the key for the storage lookup.
|
||||
// The prefixLen is limiting the length of the destination prefix.
|
||||
func (cd *CallDescriptor) GetKey(subject string) string {
|
||||
return fmt.Sprintf("%s:%s:%s:%s", cd.Direction, cd.Tenant, cd.TOR, subject)
|
||||
}
|
||||
|
||||
/*
|
||||
Splits the received timespan into sub time spans according to the activation periods intervals.
|
||||
*/
|
||||
// Splits the received timespan into sub time spans according to the activation periods intervals.
|
||||
func (cd *CallDescriptor) splitInTimeSpans(firstSpan *TimeSpan) (timespans []*TimeSpan) {
|
||||
if firstSpan == nil {
|
||||
firstSpan = &TimeSpan{TimeStart: cd.TimeStart, TimeEnd: cd.TimeEnd, CallDuration: cd.CallDuration}
|
||||
|
||||
@@ -40,15 +40,16 @@ func (rpr *RPRate) Equal(orpr *RPRate) bool {
|
||||
|
||||
type RPRateList []*RPRate
|
||||
|
||||
func (rp *RatingPlan) RateIntervalList(dId string) (ril RateIntervalList) {
|
||||
for _, rpr := range rp.DestinationRates[dId] {
|
||||
ril = append(ril, &RateInterval{
|
||||
func (rp *RatingPlan) RateIntervalList(dId string) RateIntervalList {
|
||||
ril := make(RateIntervalList, len(rp.DestinationRates[dId]))
|
||||
for i, rpr := range rp.DestinationRates[dId] {
|
||||
ril[i] = &RateInterval{
|
||||
Timing: rp.Timings[rpr.Timing],
|
||||
Rating: rp.Ratings[rpr.Rating],
|
||||
Weight: rpr.Weight,
|
||||
})
|
||||
}
|
||||
}
|
||||
return
|
||||
return ril
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user