Browse Source

fix waitgroup

Matthew R. Kasun 3 years ago
parent
commit
23c3b0c276
1 changed files with 2 additions and 0 deletions
  1. 2 0
      netclient/functions/daemon.go

+ 2 - 0
netclient/functions/daemon.go

@@ -30,6 +30,7 @@ import (
 )
 )
 
 
 var messageCache = new(sync.Map)
 var messageCache = new(sync.Map)
+
 var serverSet map[string]bool
 var serverSet map[string]bool
 
 
 const lastNodeUpdate = "lnu"
 const lastNodeUpdate = "lnu"
@@ -103,6 +104,7 @@ func startGoRoutines(wg *sync.WaitGroup) context.CancelFunc {
 			// == subscribe to all nodes for each on machine ==
 			// == subscribe to all nodes for each on machine ==
 			serverSet[server] = true
 			serverSet[server] = true
 			logger.Log(1, "started daemon for server ", server)
 			logger.Log(1, "started daemon for server ", server)
+			wg.Add(1)
 			go messageQueue(ctx, wg, &cfg)
 			go messageQueue(ctx, wg, &cfg)
 		}
 		}
 	}
 	}