summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-24 13:28:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-24 13:28:20 -0400
commit9fafddc7eb320e9399c586a901936383abb3fa4d (patch)
tree71e31f9fbdd597fa14b489ba6aae96e1f4c7ed37 /Assistant
parent72e110ce5d361b5b2621c972d6fe317c38e8cfca (diff)
make higher priorities and full scans be preserved when adding
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/ScanRemotes.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Assistant/ScanRemotes.hs b/Assistant/ScanRemotes.hs
index 2920e89c3..637522196 100644
--- a/Assistant/ScanRemotes.hs
+++ b/Assistant/ScanRemotes.hs
@@ -45,6 +45,10 @@ addScanRemotes :: ScanRemoteMap -> [Remote] -> Bool -> IO ()
addScanRemotes _ [] _ = noop
addScanRemotes v rs full = atomically $ do
m <- fromMaybe M.empty <$> tryTakeTMVar v
- putTMVar v $ M.union (M.fromList $ zip rs (map info rs)) m
+ putTMVar v $ M.unionWith merge (M.fromList $ zip rs (map info rs)) m
where
info r = ScanInfo (Remote.cost r) full
+ merge x y = ScanInfo
+ { scanPriority = max (scanPriority x) (scanPriority y)
+ , fullScan = fullScan x || fullScan y
+ }