mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
sessions: remove UpdateSRuns and lock manually in terminate
This commit is contained in:
committed by
Dan Christian Bogos
parent
e81cb4fa9b
commit
3ee6355cd2
@@ -672,7 +672,9 @@ func (sS *SessionS) BiRPCv1TerminateSession(ctx *context.Context,
|
||||
break
|
||||
}
|
||||
if !isInstantEvent {
|
||||
s.UpdateSRuns(ev, sS.cfg.SessionSCfg().AlterableFields)
|
||||
s.lk.Lock()
|
||||
s.updateSRuns(ev, sS.cfg.SessionSCfg().AlterableFields)
|
||||
s.lk.Unlock()
|
||||
}
|
||||
if err = sS.terminateSession(ctx, s,
|
||||
ev.GetDurationPtrIgnoreErrors(utils.Usage),
|
||||
|
||||
@@ -220,15 +220,3 @@ func (s *Session) updateSRuns(updEv engine.MapEvent, alterableFields utils.Strin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateSRuns updates the SRuns event with the alterable fields (is thread safe)
|
||||
func (s *Session) UpdateSRuns(updEv engine.MapEvent, alterableFields utils.StringSet) {
|
||||
if alterableFields.Size() == 0 { // do not lock if we can't update any field
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: fix deadlock when called by updateSession method.
|
||||
s.lk.Lock()
|
||||
s.updateSRuns(updEv, alterableFields)
|
||||
s.lk.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user