mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
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:
committed by
Dan Christian Bogos
parent
6cfb934c9b
commit
da6a2ee92f
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user