Exit automatic debit loops if debitStop channel was nil-led, fixes #2354

This commit is contained in:
TeoV
2020-08-30 14:54:47 +03:00
committed by Dan Christian Bogos
parent a513cd24fd
commit 4a9ef12123

View File

@@ -520,6 +520,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(