diff options
-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 + } |