sync: Sync to lower cost remotes first.
This has two benefits. 1. When a lot of refs are going to be received, get them via lower cost connection when possible. 2. Allows ctrl-c of sync after the cheaper remotes have been pulled from (or pushed to).
This commit is contained in:
parent
5ab82230f7
commit
997e29f294
2 changed files with 4 additions and 3 deletions
|
@ -59,14 +59,14 @@ syncRemotes rs = do
|
||||||
where
|
where
|
||||||
pickfast = (++) <$> listed <*> (good =<< fastest <$> available)
|
pickfast = (++) <$> listed <*> (good =<< fastest <$> available)
|
||||||
wanted
|
wanted
|
||||||
| null rs = good =<< available
|
| null rs = good =<< concat . byspeed <$> available
|
||||||
| otherwise = listed
|
| otherwise = listed
|
||||||
listed = catMaybes <$> mapM (Remote.byName . Just) rs
|
listed = catMaybes <$> mapM (Remote.byName . Just) rs
|
||||||
available = filter nonspecial <$> Remote.enabledRemoteList
|
available = filter nonspecial <$> Remote.enabledRemoteList
|
||||||
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
|
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
|
||||||
nonspecial r = Types.Remote.remotetype r == Remote.Git.remote
|
nonspecial r = Types.Remote.remotetype r == Remote.Git.remote
|
||||||
fastest = fromMaybe [] . headMaybe .
|
fastest = fromMaybe [] . headMaybe . byspeed
|
||||||
map snd . sort . M.toList . costmap
|
byspeed = map snd . sort . M.toList . costmap
|
||||||
costmap = M.fromListWith (++) . map costpair
|
costmap = M.fromListWith (++) . map costpair
|
||||||
costpair r = (Types.Remote.cost r, [r])
|
costpair r = (Types.Remote.cost r, [r])
|
||||||
|
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -2,6 +2,7 @@ git-annex (3.20120310) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* fsck: Fix up any broken links and misplaced content caused by the
|
* fsck: Fix up any broken links and misplaced content caused by the
|
||||||
directory hash calculation bug fixed in the last release.
|
directory hash calculation bug fixed in the last release.
|
||||||
|
* sync: Sync to lower cost remotes first.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sat, 10 Mar 2012 14:03:22 -0400
|
-- Joey Hess <joeyh@debian.org> Sat, 10 Mar 2012 14:03:22 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue