Exit automatic debit loops if debitStop channel was nil-led

This commit is contained in:
TeoV
2020-08-31 09:31:59 +03:00
committed by Teofil Voivozeanu
parent 5932a16383
commit 3289a59a41

View File

@@ -472,6 +472,11 @@ func (sS *SessionS) debitLoopSession(s *Session, sRunIdx int,
}
for {
s.Lock()
if s.debitStop == nil {
// session already closed (most probably from sessionEnd), fixes concurrency
s.Unlock()
return
}
var maxDebit time.Duration
if maxDebit, err = sS.debitSession(s, sRunIdx, dbtIvl, nil); err != nil {
utils.Logger.Warning(