make higher priorities and full scans be preserved when adding
This commit is contained in:
parent
72e110ce5d
commit
9fafddc7eb
1 changed files with 5 additions and 1 deletions
|
@ -45,6 +45,10 @@ addScanRemotes :: ScanRemoteMap -> [Remote] -> Bool -> IO ()
|
||||||
addScanRemotes _ [] _ = noop
|
addScanRemotes _ [] _ = noop
|
||||||
addScanRemotes v rs full = atomically $ do
|
addScanRemotes v rs full = atomically $ do
|
||||||
m <- fromMaybe M.empty <$> tryTakeTMVar v
|
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
|
where
|
||||||
info r = ScanInfo (Remote.cost r) full
|
info r = ScanInfo (Remote.cost r) full
|
||||||
|
merge x y = ScanInfo
|
||||||
|
{ scanPriority = max (scanPriority x) (scanPriority y)
|
||||||
|
, fullScan = fullScan x || fullScan y
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue