From 5d94fc550b034ef9c85c24dddb3baaebb22e9842 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 20 Aug 2021 11:25:37 +0300 Subject: [PATCH] Updated syncSessions --- sessions/sessions.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sessions/sessions.go b/sessions/sessions.go index ac7b8b782..1385cd9e4 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -1237,6 +1237,12 @@ func (sS *SessionS) getRelocateSession(cgrID string, initOriginID, // syncSessions synchronizes the active sessions with the one in the clients // it will force-disconnect the one found in SessionS but not in clients func (sS *SessionS) syncSessions() { + sS.aSsMux.RLock() + asCount := len(sS.aSessions) + sS.aSsMux.RUnlock() + if asCount == 0 { // no need to sync the sessions if none is active + return + } queriedCGRIDs := engine.NewSafEvent(nil) // need this to be var err error for _, clnt := range sS.biJClients() {