You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pattern spawns unlimited amount of goroutines. All "unlimited" things are bad - because:
because we have limited cpus/ram/disk/etc...
even if today some loop doesn't spawn much goroutines - future PR's or future bugs - may change it and we will not notice
some "for loops" are run in-parallel - means it's will be hard for us to reproduce "worst case scenario" - where N loops spawning much goroutines in same time.
let's replace it by next pattern:
g := &errgroup.Group{}
g.SetLimit(runtime.GOMAXPROCS(-1))
for {
g.Go(func() error {
})
}
if err := g.Wait(); err != nil {
return err
})
Can set any limit you like.
The text was updated successfully, but these errors were encountered:
Found many patterns like:
Examples:
getDutiesProposer
connectWithAllPeers
batchVerifyAttestations
VerifyAgainstIdentifiersAndInsertIntoTheBlobStore
This pattern spawns unlimited amount of goroutines. All "unlimited" things are bad - because:
let's replace it by next pattern:
Can set any limit you like.
The text was updated successfully, but these errors were encountered: