Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite clone logic for better performance & Fix Bugs (#18)
The clone logic was rewritten for better concurrency which yields higher performance in most cases since a lot of our time is spent in blocking IO (e.g. download chunks / writing chunks). Additionally some parallelism was added to the clone code for the parts that are CPU intensive (i.e. chunk hashing). A number of outstanding bugs were fixed especially around progress reporting. **Changes**: - Rewrote cloning logic so it can be done in multiple steps concurrently for multiple files: - Enables more concurrency and parallelism where possible - Improves progress reporting for each step (chunking, downloading, etc.) - Code is easier to follow - Progress reporting is more accurate, especially in case for partial downloads when chunks are already present - Refactored progress to use shared state instead of messages - This improves UI performance because we don't need to drain every message but can just update the progress on each tick. In some cases we literally took more time to update the UI than the actual update process took - Simplifies the code by reducing message passing handlers - Fixed a lurking bug where the child process (e.g. trose or new updater) would not be able to exit cleanly because parent stdio handles were dropped. For updater to updater process starts this would cause the updater to never exit in the background even when closing it which caused updates to continue - Removed all the shutdown receivers which were incorrectly added to protect against this - Added text to status bar for different stages to provide extra information - Changed updater download logic - Previously the existing process was renamed then the updater was downloaded. If the updater failed users would be left without a functioning updater - Now the updater will be downloaded AND then the files will be renamed - The full updater will always be redownloaded to avoid any issues - TODO: Atomic renames using `FileReplace` on windows and `renameat2` on linux (and macos?)
- Loading branch information