sessions: remove UpdateSRuns and lock manually in terminate

This commit is contained in:
ionutboangiu
2025-09-01 21:21:56 +03:00
committed by Dan Christian Bogos
parent e81cb4fa9b
commit 3ee6355cd2
2 changed files with 3 additions and 13 deletions

View File

@@ -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),

View File

@@ -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()
}