summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-23 15:48:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-23 15:48:31 -0400
commit37b960d3b05fdcda083d364c8e63e82f4615048c (patch)
tree49522880204abac3d6719fc7c5e37518972afa59
parent6420fa6c0893ec15436243a03544914383acb936 (diff)
don't rely on hasKeyCheap in the transfer scan
The problem with using it here is that, if a removable drive is scanned and gets disconnected during the scan, testing for all the files will indicate it doesn't have them, and the scan is logged as completed successfully, without necessary transfers being queued.
-rw-r--r--Assistant/Threads/TransferScanner.hs16
1 files changed, 5 insertions, 11 deletions
diff --git a/Assistant/Threads/TransferScanner.hs b/Assistant/Threads/TransferScanner.hs
index b3222edb4..8dc3a6a98 100644
--- a/Assistant/Threads/TransferScanner.hs
+++ b/Assistant/Threads/TransferScanner.hs
@@ -39,8 +39,6 @@ transferScannerThread st dstatus scanremotes transferqueue = do
void $ alertWhile dstatus (scanAlert r) $
expensiveScan st dstatus transferqueue r
liftIO $ debug thisThread ["finished scan of", show r]
- runThreadState st $ inRepo $
- transferScanned $ Remote.uuid r
else failedTransferScan st dstatus transferqueue r
{- This is a cheap scan for failed transfers involving a remote. -}
@@ -66,6 +64,8 @@ expensiveScan st dstatus transferqueue r = do
g <- runThreadState st $ fromRepo id
files <- LsFiles.inRepo [] g
go files
+ runThreadState st $ inRepo $
+ transferScanned $ Remote.uuid r
return True
where
go [] = noop
@@ -90,12 +90,6 @@ expensiveScan st dstatus transferqueue r = do
u = Remote.uuid r
enqueue f t = queueTransferWhenSmall transferqueue dstatus (Just f) t r
- {- Look directly in remote for the key when it's cheap;
- - otherwise rely on the location log. -}
- remotehas key
- | Remote.hasKeyCheap r = (==)
- <$> pure (Right True)
- <*> Remote.hasKey r key
- | otherwise = elem
- <$> pure u
- <*> loggedLocations key
+ remotehas key = elem
+ <$> pure u
+ <*> loggedLocations key