Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
4624628f
Commit
4624628f
authored
Jan 5, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
revert getroundresults changes
parent
3a777b78
No related branches found
No related tags found
2 merge requests
!170
Release
,
!119
revert getroundresults changes
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/results.go
+13
-31
13 additions, 31 deletions
api/results.go
with
13 additions
and
31 deletions
api/results.go
+
13
−
31
View file @
4624628f
...
...
@@ -93,13 +93,6 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
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
for
_
,
rnd
:=
range
roundList
{
// 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,
}
else
{
// If in progress, add a channel monitoring its state
roundEvents
.
AddRoundEventChan
(
rnd
,
sendResults
,
roundEventTimeout
,
states
.
COMPLETED
,
states
.
FAILED
)
timeout
-
time
.
Millisecond
,
states
.
COMPLETED
,
states
.
FAILED
)
numResults
++
}
}
else
{
...
...
@@ -129,7 +122,7 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
}
else
{
// Otherwise, monitor its progress
roundEvents
.
AddRoundEventChan
(
rnd
,
sendResults
,
roundEventTimeout
,
states
.
COMPLETED
,
states
.
FAILED
)
timeout
-
time
.
Millisecond
,
states
.
COMPLETED
,
states
.
FAILED
)
numResults
++
}
}
...
...
@@ -158,16 +151,13 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
roundCallback
(
false
,
true
,
roundsResults
)
return
case
roundReport
:=
<-
sendResults
:
// Skip if the round is timed out, meaning unknown from historical rounds
// or timed out on RoundEvents channel
if
roundReport
.
TimedOut
{
// Generate a message to track the timed out round
timeoutRequest
:=
&
pb
.
HistoricalRounds
{
Rounds
:
[]
uint64
{
roundReport
.
RoundInfo
.
ID
},
}
// 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
)
numResults
--
// Skip if the round is nil (unknown from historical rounds)
// they default to timed out, so correct behavior is preserved
if
roundReport
.
RoundInfo
==
nil
||
roundReport
.
TimedOut
{
allRoundsSucceeded
=
false
}
else
{
// If available, denote the result
roundId
:=
id
.
Round
(
roundReport
.
RoundInfo
.
ID
)
...
...
@@ -176,8 +166,8 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration,
}
else
{
roundsResults
[
roundId
]
=
Failed
allRoundsSucceeded
=
false
}
numResults
--
}
}
}
...
...
@@ -216,17 +206,9 @@ func (c *Client) getHistoricalRounds(msg *pb.HistoricalRounds,
}
// Service historical rounds, sending back to the caller thread
for
i
,
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
{
for
_
,
ri
:=
range
resp
.
Rounds
{
sendResults
<-
ds
.
EventReturn
{
RoundInfo
:
ri
,
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment