From 566af40c6889bda6bca67846ad9eefb266cb9d65 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 3a2daa295..4b7fe670c 100644 --- a/packages/debian/changelog +++ b/packages/debian/changelog @@ -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 Thu, 4 May 2021 12:05:00 +0200 diff --git a/sessions/sessions.go b/sessions/sessions.go index b465b6795..567a5441e 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 }