The sessions are no longer terminated on shutdown if the replication_conns are set

This commit is contained in:
Trial97
2021-05-20 14:02:42 +03:00
committed by Dan Christian Bogos
parent ccbccb8ff7
commit 3f06d822d6
2 changed files with 10 additions and 7 deletions

View File

@@ -163,6 +163,7 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
* [AttributeS] Added any_context config to control the matching attributes
* [DispatcherS] Added any_subsyste config to control the matching dispatchers
* [StatS] AverageCallCost and TotalCallCost now returns error for negative Cost field
* [SessionS] The sessions are no longer terminated on shutdown if the replication_conns are set
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200

View File

@@ -110,14 +110,16 @@ func (sS *SessionS) ListenAndServe(stopChan chan struct{}) {
// Shutdown is called by engine to clear states
func (sS *SessionS) Shutdown() (err error) {
var hasErr bool
for _, s := range sS.getSessions("", false) { // Force sessions shutdown
if err = sS.terminateSession(s, nil, nil, nil, false); err != nil {
hasErr = true
if len(sS.cgrCfg.SessionSCfg().ReplicationConns) == 0 {
var hasErr bool
for _, s := range sS.getSessions("", false) { // Force sessions shutdown
if err = sS.terminateSession(s, nil, nil, nil, false); err != nil {
hasErr = true
}
}
if hasErr {
return utils.ErrPartiallyExecuted
}
}
if hasErr {
return utils.ErrPartiallyExecuted
}
return
}