Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paratrie 2 #13958

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Paratrie 2 #13958

wants to merge 7 commits into from

Conversation

shotasilagadze
Copy link
Contributor

No description provided.

@shotasilagadze shotasilagadze force-pushed the paratrie-2 branch 7 times, most recently from 4258b75 to 6e27dd1 Compare February 26, 2025 11:44
// we must submit the nibble updates and reinitialise slice
if len(nibbleUpdates) != 0 {
passedUpdates := append([]*nibbleUpdate{}, nibbleUpdates...)
/* go */ phph.StartKeyProcessing(ctx, errChan, passedUpdates)
Copy link
Collaborator

@AskAlexSharov AskAlexSharov Mar 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would advise: to run group of "similar" goroutines: use errgroup.WithContext
it will:

  • cancel other goroutines if one failed
  • don't need errChan - just return err as any other golang code
  • can set max amount of simultaneous goroutines (to limit ram use, or if machine is small, etc...): g.SetLimit(6) (even if you always calc 16 prefixes in-parallel)
  • easier to understand when "work is done" and propagate error if need. by if err := g.Wait(); err != nil { return err }

Only important limitation:

  • use 1 errgroup for 1 set of similar goroutines. Example: If you have another goroutine for logging progress - don't add it to errgroup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants