Skip to content
Snippets Groups Projects
Commit 4624628f authored by Jake Taylor's avatar Jake Taylor
Browse files

revert getroundresults changes

parent 3a777b78
No related branches found
No related tags found
2 merge requests!170Release,!119revert getroundresults changes
...@@ -93,13 +93,6 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration, ...@@ -93,13 +93,6 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
oldestRound := networkInstance.GetOldestRoundID() oldestRound := networkInstance.GetOldestRoundID()
// Set a lower timeout so there is room for retries,
// while ensuring it does not go too low and cause too many timeouts
roundEventTimeout := 5 * time.Second
if timeout < roundEventTimeout {
roundEventTimeout = timeout
}
// Parse and adjudicate every round // Parse and adjudicate every round
for _, rnd := range roundList { for _, rnd := range roundList {
// Every round is timed out by default, until proven to have finished // Every round is timed out by default, until proven to have finished
...@@ -116,7 +109,7 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration, ...@@ -116,7 +109,7 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
} else { } else {
// If in progress, add a channel monitoring its state // If in progress, add a channel monitoring its state
roundEvents.AddRoundEventChan(rnd, sendResults, roundEvents.AddRoundEventChan(rnd, sendResults,
roundEventTimeout, states.COMPLETED, states.FAILED) timeout-time.Millisecond, states.COMPLETED, states.FAILED)
numResults++ numResults++
} }
} else { } else {
...@@ -129,7 +122,7 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration, ...@@ -129,7 +122,7 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
} else { } else {
// Otherwise, monitor its progress // Otherwise, monitor its progress
roundEvents.AddRoundEventChan(rnd, sendResults, roundEvents.AddRoundEventChan(rnd, sendResults,
roundEventTimeout, states.COMPLETED, states.FAILED) timeout-time.Millisecond, states.COMPLETED, states.FAILED)
numResults++ numResults++
} }
} }
...@@ -158,16 +151,13 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration, ...@@ -158,16 +151,13 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
roundCallback(false, true, roundsResults) roundCallback(false, true, roundsResults)
return return
case roundReport := <-sendResults: case roundReport := <-sendResults:
// Skip if the round is timed out, meaning unknown from historical rounds
// or timed out on RoundEvents channel numResults--
if roundReport.TimedOut {
// Generate a message to track the timed out round // Skip if the round is nil (unknown from historical rounds)
timeoutRequest := &pb.HistoricalRounds{ // they default to timed out, so correct behavior is preserved
Rounds: []uint64{roundReport.RoundInfo.ID}, if roundReport.RoundInfo == nil || roundReport.TimedOut {
} allRoundsSucceeded = false
// Request that round's information, feeding back into sendResults
jww.DEBUG.Printf("Sending HistoricalRounds retry for Round %d", roundReport.RoundInfo.ID)
go c.getHistoricalRounds(timeoutRequest, sendResults, commsInterface)
} else { } else {
// If available, denote the result // If available, denote the result
roundId := id.Round(roundReport.RoundInfo.ID) roundId := id.Round(roundReport.RoundInfo.ID)
...@@ -176,8 +166,8 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration, ...@@ -176,8 +166,8 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
} else { } else {
roundsResults[roundId] = Failed roundsResults[roundId] = Failed
allRoundsSucceeded = false allRoundsSucceeded = false
} }
numResults--
} }
} }
} }
...@@ -216,17 +206,9 @@ func (c *Client) getHistoricalRounds(msg *pb.HistoricalRounds, ...@@ -216,17 +206,9 @@ func (c *Client) getHistoricalRounds(msg *pb.HistoricalRounds,
} }
// Service historical rounds, sending back to the caller thread // Service historical rounds, sending back to the caller thread
for i, ri := range resp.Rounds { for _, ri := range resp.Rounds {
if ri == nil {
// Handle unknown by historical rounds
sendResults <- ds.EventReturn{
RoundInfo: &pb.RoundInfo{ID: msg.Rounds[i]},
TimedOut: true,
}
} else {
sendResults <- ds.EventReturn{ sendResults <- ds.EventReturn{
RoundInfo: ri, RoundInfo: ri,
} }
} }
} }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment