-
Notifications
You must be signed in to change notification settings - Fork 126
performActionOnBinaryDataFromFilter Parallelism #5439
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
base: main
Are you sure you want to change the base?
performActionOnBinaryDataFromFilter Parallelism #5439
Conversation
| var wg sync.WaitGroup | ||
|
|
||
| // In one routine, get all IDs matching the filter and pass them into the ids channel. | ||
| wg.Add(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think this waitGroup is necessary, but good programming practices maybe?
| }() | ||
| }() | ||
| } | ||
| downloadWG.Wait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this go after wg.Wait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
| err := actionOnBinaryData(id) | ||
| if err != nil { | ||
| errs <- err | ||
| cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to return here? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think the original code's count was off by one!
Was working on something adjacent and was confused by the additional thread, decided to add a quick fix.
Times for downloading a 3,036 dataset
This isn't definitive proof of a speed up since this is just one trial and I can test more if necessary, but this is also a readability improvement and removes the unprotected
donevariable.Verified appropriate behavior on random error.
Please lmk if the batching was there for a reason that I've overlooked, it doesn't seem to preserve order upon first glance so not sure why it's there.