mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Use less goroutines in validator runner (#5328)
* Add buildbuddy BES (#5325) * Add buildbuddy BES * Use less goroutines when running validator * per-role based goroutines * Merge branch 'master' into validator-issue-4702
This commit is contained in:
@@ -101,24 +101,24 @@ func run(ctx context.Context, v Validator) {
|
||||
continue
|
||||
}
|
||||
for id, roles := range allRoles {
|
||||
wg.Add(1)
|
||||
go func(roles []validatorRole, id [48]byte) {
|
||||
for _, role := range roles {
|
||||
wg.Add(len(roles))
|
||||
for _, role := range roles {
|
||||
go func(role validatorRole, id [48]byte) {
|
||||
defer wg.Done()
|
||||
switch role {
|
||||
case roleAttester:
|
||||
go v.SubmitAttestation(slotCtx, slot, id)
|
||||
v.SubmitAttestation(slotCtx, slot, id)
|
||||
case roleProposer:
|
||||
go v.ProposeBlock(slotCtx, slot, id)
|
||||
v.ProposeBlock(slotCtx, slot, id)
|
||||
case roleAggregator:
|
||||
go v.SubmitAggregateAndProof(slotCtx, slot, id)
|
||||
v.SubmitAggregateAndProof(slotCtx, slot, id)
|
||||
case roleUnknown:
|
||||
log.WithField("pubKey", fmt.Sprintf("%#x", bytesutil.Trunc(id[:]))).Trace("No active roles, doing nothing")
|
||||
default:
|
||||
log.Warnf("Unhandled role %v", role)
|
||||
}
|
||||
}
|
||||
wg.Done()
|
||||
}(roles, id)
|
||||
}(role, id)
|
||||
}
|
||||
}
|
||||
// Wait for all processes to complete, then report span complete.
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user