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
Parallel pull from Share #3153
Parallel pull from Share #3153
Conversation
|
||
workerCount <- newWorkerCount | ||
|
||
Ki.scoped \scope -> do |
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.
This works really nicely 👍🏼 Good work on this lib
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.
Thanks!
unison-cli/src/Unison/Share/Sync.hs
Outdated
elaborator hashesVar uninsertedHashesVar newTempEntitiesQueue workerCount = | ||
connect \conn -> | ||
forever do | ||
(join . atomically) do |
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.
Is there a benefit to the (join . atomically) do
pattern here over something like:
forever do
mayNewTempEntities <- atomically $ do ...
case mayNewTempEntities of
Nothing -> ...
Just _ -> ...
?
I find interleaving STM and IO makes it tougher to see what's being accomplished transactionally 😅
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.
Sure, we can switch it to not do the join . atomically
thing. I think instead of a Maybe (Set Hash)
(or w/e) I'll go with a one-off data type, so it's more clear what going down one branch versus another means.
also reduce number of downloaders from 10 to 5, because 5 has performed better in a few tests
Overview
This PR implements a concurrent pull procedure involving a few different threads: