mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add warning for uncomputable increments
This commit is contained in:
committed by
Dan Christian Bogos
parent
7a0ff57a36
commit
e17d952f9c
@@ -471,6 +471,10 @@ func (ts *TimeSpan) createIncrementsSlice() {
|
||||
// because ts cost is rounded
|
||||
//incrementCost := rate / rateUnit.Seconds() * rateIncrement.Seconds()
|
||||
nbIncrements := int(ts.GetDuration() / rateIncrement)
|
||||
if nbIncrements < 0 {
|
||||
utils.Logger.Warning(fmt.Sprintf("error: <%s with %+v>, when creating increments slice, TimeSpan: %s", utils.ErrUncomputableIncrement, nbIncrements, utils.ToJSON(ts)))
|
||||
return
|
||||
}
|
||||
if nbIncrements > config.CgrConfig().RalsCfg().MaxIncrements {
|
||||
utils.Logger.Warning(fmt.Sprintf("error: <%s with %+v>, when creating increments slice, TimeSpan: %s", utils.ErrMaxIncrementsExceeded, nbIncrements, utils.ToJSON(ts)))
|
||||
ts.Increments = make([]*Increment, 0)
|
||||
|
||||
@@ -70,6 +70,7 @@ var (
|
||||
ErrUnsupportedFormat = errors.New("UNSUPPORTED_FORMAT")
|
||||
ErrNoDatabaseConn = errors.New("NO_DATABASE_CONNECTION")
|
||||
ErrMaxIncrementsExceeded = errors.New("MAX_INCREMENTS_EXCEEDED")
|
||||
ErrUncomputableIncrement = errors.New("UNCOMPUTABLE_INCREMENT")
|
||||
ErrIndexOutOfBounds = errors.New("INDEX_OUT_OF_BOUNDS")
|
||||
ErrWrongPath = errors.New("WRONG_PATH")
|
||||
ErrServiceAlreadyRunning = fmt.Errorf("service already running")
|
||||
|
||||
Reference in New Issue
Block a user