summaryrefslogtreecommitdiff
path: root/Assistant/Threads/TransferScanner.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-25 11:46:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-25 11:46:17 -0400
commit2590e1099ff283cc1c388f2dbdcbdd0ac6905a64 (patch)
tree85c5a0222b5d5a51dda5aed1cef2c85dd0b7e05e /Assistant/Threads/TransferScanner.hs
parentd9c5d32c34885cac67c44c633c5351461902d166 (diff)
assistant: Clear the list of failed transfers when doing a full transfer scan. This prevents repeated retries to download files that are not available, or are not referenced by the current git tree.
This is motivated by a user report that the assistant was repeatedly retrying transfers of files that had been deleted (in direct mode, so removing the only copy). Note that the glacier code retries failed transfers after a while to retry downloads that have aged long enough to be available. This is ok; if we're doing a full transfer scan we'll retry on every file that is still in the git tree. Also note that this makes the assistant less likely to get every file referenced by old revs of the git tree. Not something the assistant tries to ensure anyway, so I feel this is acceptable.
Diffstat (limited to 'Assistant/Threads/TransferScanner.hs')
-rw-r--r--Assistant/Threads/TransferScanner.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Assistant/Threads/TransferScanner.hs b/Assistant/Threads/TransferScanner.hs
index 5a6871fdb..631310987 100644
--- a/Assistant/Threads/TransferScanner.hs
+++ b/Assistant/Threads/TransferScanner.hs
@@ -81,8 +81,7 @@ transferScannerThread urlrenderer = namedThread "TransferScanner" $ do
{- This is a cheap scan for failed transfers involving a remote. -}
failedTransferScan :: Remote -> Assistant ()
failedTransferScan r = do
- failed <- liftAnnex $ getFailedTransfers (Remote.uuid r)
- liftAnnex $ mapM_ removeFailedTransfer $ map fst failed
+ failed <- liftAnnex $ clearFailedTransfers (Remote.uuid r)
mapM_ retry failed
where
retry (t, info)
@@ -98,7 +97,7 @@ failedTransferScan r = do
- key, so it's not redundantly checked here. -}
requeue t info
requeue t info = queueTransferWhenSmall "retrying failed transfer" (associatedFile info) t r
-
+
{- This is a expensive scan through the full git work tree, finding
- files to transfer. The scan is blocked when the transfer queue gets
- too large.
@@ -118,8 +117,12 @@ expensiveScan :: UrlRenderer -> [Remote] -> Assistant ()
expensiveScan urlrenderer rs = unless onlyweb $ batch <~> do
debug ["starting scan of", show visiblers]
+ let us = map Remote.uuid rs
+
+ mapM_ (liftAnnex . clearFailedTransfers) us
+
unwantedrs <- liftAnnex $ S.fromList
- <$> filterM inUnwantedGroup (map Remote.uuid rs)
+ <$> filterM inUnwantedGroup us
g <- liftAnnex gitRepo
(files, cleanup) <- liftIO $ LsFiles.inRepo [] g