mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 21:59:53 +05:00
Added delay on error from disconnect session
This commit is contained in:
committed by
Alexandru Ionut Tripon
parent
deec88bea3
commit
d67ff5e163
@@ -559,7 +559,11 @@ func (sS *SessionS) debitLoopSession(s *Session, sRunIdx int,
|
||||
dscReason = err.Error()
|
||||
}
|
||||
// try to disconect the session n times before we force terminate it on our side
|
||||
fib := utils.Fib()
|
||||
for i := 0; i < sS.cgrCfg.SessionSCfg().TerminateAttempts; i++ {
|
||||
if i != 0 { // not the first iteration
|
||||
time.Sleep(time.Duration(fib()) * time.Millisecond)
|
||||
}
|
||||
if err = sS.disconnectSession(s, dscReason); err == nil {
|
||||
s.Unlock()
|
||||
return
|
||||
@@ -594,10 +598,17 @@ func (sS *SessionS) debitLoopSession(s *Session, sRunIdx int,
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
// try to disconect the session n times before we force terminate it on our side
|
||||
fib := utils.Fib()
|
||||
for i := 0; i < sS.cgrCfg.SessionSCfg().TerminateAttempts; i++ {
|
||||
if i != 0 { // not the first iteration
|
||||
time.Sleep(time.Duration(fib()) * time.Millisecond)
|
||||
}
|
||||
if err = sS.disconnectSession(s, utils.ErrInsufficientCredit.Error()); err == nil {
|
||||
return
|
||||
}
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> could not disconnect session: %s, error: %s",
|
||||
utils.SessionS, s.cgrID(), err.Error()))
|
||||
}
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> could not disconnect session: <%s>, error: <%s>",
|
||||
|
||||
Reference in New Issue
Block a user