diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-24 13:28:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-24 13:28:20 -0400 |
commit | 9fafddc7eb320e9399c586a901936383abb3fa4d (patch) | |
tree | 71e31f9fbdd597fa14b489ba6aae96e1f4c7ed37 /Assistant | |
parent | 72e110ce5d361b5b2621c972d6fe317c38e8cfca (diff) |
make higher priorities and full scans be preserved when adding
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/ScanRemotes.hs | 6 |
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 + } |