mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 05:09:54 +05:00
LCR Fix for nil cached keys
This commit is contained in:
@@ -953,7 +953,7 @@ func (cd *CallDescriptor) GetLCRFromStorage() (*LCR, error) {
|
||||
for _, key := range keyVariants {
|
||||
if lcr, err := ratingStorage.GetLCR(key, false, utils.NonTransactional); err != nil && err != utils.ErrNotFound {
|
||||
return nil, err
|
||||
} else if err == nil {
|
||||
} else if err == nil && lcr != nil {
|
||||
return lcr, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ func RatingProfileSubjectPrefixMatching(key string) (rp *RatingProfile, err erro
|
||||
return ratingStorage.GetRatingProfile(key, false, utils.NonTransactional)
|
||||
}
|
||||
if rp, err = ratingStorage.GetRatingProfile(key, false, utils.NonTransactional); err == nil && rp != nil { // rp nil represents cached no-result
|
||||
return rp, err
|
||||
return
|
||||
}
|
||||
lastIndex := strings.LastIndex(key, utils.CONCATENATED_KEY_SEP)
|
||||
baseKey := key[:lastIndex]
|
||||
@@ -267,7 +267,7 @@ func RatingProfileSubjectPrefixMatching(key string) (rp *RatingProfile, err erro
|
||||
lenSubject := len(subject)
|
||||
for i := 1; i < lenSubject-1; i++ {
|
||||
if rp, err = ratingStorage.GetRatingProfile(baseKey+subject[:lenSubject-i], false, utils.NonTransactional); err == nil && rp != nil {
|
||||
return rp, err
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user