avoid enqueing downloads from remotes that don't have the key
This commit is contained in:
parent
b7d3cefde9
commit
c34d8ae088
1 changed files with 11 additions and 11 deletions
|
@ -33,24 +33,24 @@ stubInfo f = TransferInfo
|
||||||
{- Adds pending transfers to the end of the queue for some of the known
|
{- Adds pending transfers to the end of the queue for some of the known
|
||||||
- remotes. -}
|
- remotes. -}
|
||||||
queueTransfers :: TransferQueue -> DaemonStatusHandle -> Key -> AssociatedFile -> Direction -> Annex ()
|
queueTransfers :: TransferQueue -> DaemonStatusHandle -> Key -> AssociatedFile -> Direction -> Annex ()
|
||||||
queueTransfers q daemonstatus k f direction =
|
queueTransfers q daemonstatus k f direction = do
|
||||||
|
rs <- knownRemotes <$> getDaemonStatus daemonstatus
|
||||||
mapM_ (\r -> queue r $ gentransfer r)
|
mapM_ (\r -> queue r $ gentransfer r)
|
||||||
=<< sufficientremotes . knownRemotes
|
=<< sufficientremotes rs
|
||||||
<$> getDaemonStatus daemonstatus
|
|
||||||
where
|
where
|
||||||
sufficientremotes l
|
sufficientremotes l
|
||||||
-- Queue downloads from all remotes, with the
|
-- Queue downloads from all remotes that
|
||||||
-- cheapest ones first. More expensive ones will
|
-- have the key, with the cheapest ones first.
|
||||||
-- only be tried if downloading from a cheap one
|
-- More expensive ones will only be tried if
|
||||||
-- fails.
|
-- downloading from a cheap one fails.
|
||||||
-- TODO: avoid downloading from remotes that don't
|
| direction == Download = do
|
||||||
-- have the key.
|
uuids <- Remote.keyLocations k
|
||||||
| direction == Download = l
|
return $ filter (\r -> uuid r `elem` uuids) l
|
||||||
-- TODO: Determine a smaller set of remotes that
|
-- TODO: Determine a smaller set of remotes that
|
||||||
-- can be uploaded to, in order to ensure all
|
-- can be uploaded to, in order to ensure all
|
||||||
-- remotes can access the content. Currently,
|
-- remotes can access the content. Currently,
|
||||||
-- send to every remote we can.
|
-- send to every remote we can.
|
||||||
| otherwise = l
|
| otherwise = return l
|
||||||
gentransfer r = Transfer
|
gentransfer r = Transfer
|
||||||
{ transferDirection = direction
|
{ transferDirection = direction
|
||||||
, transferKey = k
|
, transferKey = k
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue