diff --git a/network/rounds/historical.go b/network/rounds/historical.go index b10e8102aa1ca2428ba38fd184688e1d15cb0dc8..1cc6c91a82b697d8f05f2b8ee6b43ef8cc3c3c0f 100644 --- a/network/rounds/historical.go +++ b/network/rounds/historical.go @@ -73,10 +73,12 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c } // get new round to lookup and force a lookup if case r := <-m.historicalRounds: + jww.DEBUG.Printf("Recieved and quing round %d for " + + "historical rounds lookup", r.rid) roundRequests = append(roundRequests, r) if len(roundRequests) > int(m.params.MaxHistoricalRounds) { shouldProcess = true - } else if len(roundRequests) == 1 { + } else if len(roundRequests) != 0 { //if this is the first round, start the timeout timerCh = time.NewTimer(m.params.HistoricalRoundsPeriod).C } @@ -102,7 +104,7 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c Rounds: rounds, } - jww.DEBUG.Printf("Requesting Historical rounds (%v) from " + + jww.DEBUG.Printf("Requesting Historical rounds %v from " + "gateway %s", rounds, gwHost.GetId()) response, err := comm.RequestHistoricalRounds(gwHost, hr) @@ -121,7 +123,7 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c // need be be removes as processing so the network follower will // pick them up in the future. if roundInfo == nil { - jww.ERROR.Printf("could not retreive "+ + jww.ERROR.Printf("Failed to retreive "+ "historical round %d", roundRequests[i].rid) m.p.Fail(roundRequests[i].rid) continue @@ -134,5 +136,8 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c } m.lookupRoundMessages <- rl } + + //clear the buffer now that all have been checked + roundRequests = make([]historicalRoundRequest, 0) } }