Pass clnt as a parameter to the goroutine in syncSessions

This prevents the clnt loop variable to be captured by the
func literal.
This commit is contained in:
ionutboangiu
2023-10-09 11:28:50 -04:00
committed by Dan Christian Bogos
parent 6cfb934c9b
commit da6a2ee92f

View File

@@ -1379,9 +1379,9 @@ func (sS *SessionS) syncSessions() {
for _, clnt := range sS.biJClients() {
wg.Add(1)
go func() { // query all connections at once
go func(c *biJClient) { // query all connections at once
var queriedSessionIDs []*SessionID
if err := clnt.conn.Call(context.TODO(), utils.SessionSv1GetActiveSessionIDs,
if err := c.conn.Call(context.TODO(), utils.SessionSv1GetActiveSessionIDs,
utils.EmptyString, &queriedSessionIDs); err != nil &&
err.Error() != utils.ErrNoActiveSession.Error() {
utils.Logger.Warning(
@@ -1392,7 +1392,7 @@ func (sS *SessionS) syncSessions() {
queriedCGRIDs.Set(sessionID.CGRID(), struct{}{})
}
wg.Done()
}()
}(clnt)
}
wg.Wait() // wait for all clients to finish in one way or another