diff --git a/lg.go b/lg.go index 30f6cf9..a1fcccc 100644 --- a/lg.go +++ b/lg.go @@ -96,10 +96,8 @@ func (p *Prefix) checkLGState() { for _, rrc := range ripeStatLookingGlassResp.Data.Rrcs { upstreams := []string{} upstreams2 := []string{} - communities := []string{} for _, peer := range rrc.Peers { - communities = append(communities, peer.Community) asPathSplit := strings.Split(peer.AsPath, " ") upstream := "" upstream2 := "" diff --git a/main.go b/main.go index dab8cc7..83e9850 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "os" "os/signal" "strconv" + "sync" "syscall" "time" @@ -34,10 +35,17 @@ func updateStates() { fetchRisPeer() + var wg sync.WaitGroup + wg.Add(len(monitorState)) + for _, prefix := range monitorState { - prefix.checkVisState() - prefix.checkLGState() + go func() { + defer wg.Done() + prefix.checkVisState() + prefix.checkLGState() + }() } + wg.Wait() } func init() {