Skip to content

Commit

Permalink
(NOBIDS) fix errgroup ctx handling
Browse files Browse the repository at this point in the history
  • Loading branch information
guybrush committed Jun 29, 2023
1 parent e644da8 commit 9068aba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/eth1indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ func IndexFromNode(bt *db.Bigtable, client *rpc.ErigonClient, start, end, concur
g.Go(func() error {
select {
case <-gCtx.Done():
return nil // halt once processing of a block failed
return gCtx.Err()
default:
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/misc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func updateAggreationBits(rpcClient *rpc.LighthouseClient, startEpoch uint64, en
g.Go(func() error {
select {
case <-gCtx.Done():
return nil // halt once processing of a slot failed
return gCtx.Err()
default:
}

Expand Down Expand Up @@ -227,7 +227,7 @@ func updateAggreationBits(rpcClient *rpc.LighthouseClient, startEpoch uint64, en
g.Go(func() error {
select {
case <-gCtx.Done():
return nil // halt once processing of a slot failed
return gCtx.Err()
default:
}
var aggregationbits *[]byte
Expand Down
4 changes: 2 additions & 2 deletions db/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ func (bigtable *Bigtable) GetValidatorBalanceStatistics(startEpoch, endEpoch uin
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
ranges := bigtable.getEpochRanges(fromEpoch, toEpoch)
Expand Down Expand Up @@ -1615,7 +1615,7 @@ func (bigtable *Bigtable) GetAggregatedValidatorIncomeDetailsHistory(validators
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
ranges := bigtable.getEpochRanges(fromEpoch, toEpoch)
Expand Down
10 changes: 5 additions & 5 deletions db/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func WriteValidatorTotalPerformance(day uint64) error {
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
_, err = WriterDb.Exec(`
Expand Down Expand Up @@ -654,7 +654,7 @@ func WriteValidatorClIcome(day uint64) error {
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
_, err := WriterDb.Exec(stmt, valueArgs...)
Expand Down Expand Up @@ -755,7 +755,7 @@ func WriteValidatorBalances(day uint64) error {
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
defer logger.Infof("saving validator balance batch %v completed", start)
Expand Down Expand Up @@ -1010,7 +1010,7 @@ func WriteValidatorFailedAttestationsStatisticsForDay(day uint64) error {
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
ma, err := BigtableClient.GetValidatorMissedAttestationsCount([]uint64{}, fromEpoch, toEpoch)
Expand Down Expand Up @@ -1063,7 +1063,7 @@ func WriteValidatorFailedAttestationsStatisticsForDay(day uint64) error {
g.Go(func() error {
select {
case <-gCtx.Done():
return nil
return gCtx.Err()
default:
}
return saveFailedAttestationBatch(maArr[start:end], day)
Expand Down

0 comments on commit 9068aba

Please sign in to comment.