From 3f06d822d64925695ef49b56438b3a208a98ea97 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 20 May 2021 14:02:42 +0300 Subject: [PATCH] The sessions are no longer terminated on shutdown if the replication_conns are set --- packages/debian/changelog | 1 + sessions/sessions.go | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/debian/changelog b/packages/debian/changelog index 4fa6ccc57..ab084f278 100644 --- a/packages/debian/changelog +++ b/packages/debian/changelog @@ -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 Wed, 19 Feb 2020 13:25:52 +0200 diff --git a/sessions/sessions.go b/sessions/sessions.go index 848e88480..6fe305dc6 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -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 }