diff --git a/sessions/sessions.go b/sessions/sessions.go index 6fe305dc6..bfe431089 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -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>",