File tree 1 file changed +5
-0
lines changed
consensus/hotstuff/voteaggregator
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,9 @@ func NewVoteAggregator(
109
109
110
110
// start vote collectors
111
111
collectors .Start (signalerCtx )
112
+
113
+ // Handle the component lifecycle in a separate goroutine so we can capture any errors
114
+ // thrown during initialization in the main goroutine.
112
115
go func () {
113
116
if err := util .WaitClosed (parentCtx , collectors .Ready ()); err == nil {
114
117
// only signal ready when collectors are ready, but always handle shutdown
@@ -122,6 +125,8 @@ func NewVoteAggregator(
122
125
123
126
// since we are breaking the connection between parentCtx and signalerCtx, we need to
124
127
// explicitly rethrow any errors from signalerCtx to parentCtx, otherwise they are dropped.
128
+ // Handle errors in the main worker goroutine to guarantee that they are rethrown to the parent
129
+ // before the component is marked done.
125
130
if err := util .WaitError (errCh , collectors .Done ()); err != nil {
126
131
parentCtx .Throw (err )
127
132
}
You can’t perform that action at this time.
0 commit comments