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 3d3540b486
commit 566af40c68
2 changed files with 10 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ cgrates (1.0) 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> Thu, 4 May 2021 12:05:00 +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
}