From ec23c75632cf1b8e4e3d5049a2c0a7623a9ae958 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 14 Oct 2012 14:34:05 -0400 Subject: avoid queuing transfers for remotes after syncing to them is paused This avoids the expensive transfer scan relying on its list of remotes to scan being accurate throughout, which it will not be when the user pauses syncing to a remote. I feel it's ok to queue transfers to *any* known remote, not just the ones being scanned. Note that there are still small races where after syncing to a remote is paused, a transfer can be queued for it. Not just in the expensive transfer scan, but in the cheap failed transfer scan, and elsewhere. --- Assistant/Threads/TransferScanner.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Assistant') diff --git a/Assistant/Threads/TransferScanner.hs b/Assistant/Threads/TransferScanner.hs index 56ba63ff1..8f44f24d1 100644 --- a/Assistant/Threads/TransferScanner.hs +++ b/Assistant/Threads/TransferScanner.hs @@ -87,7 +87,7 @@ failedTransferScan st dstatus transferqueue r = do transferqueue dstatus (associatedFile info) t r {- This is a expensive scan through the full git work tree, finding - - files to download from or upload to any of the remotes. + - files to download from or upload to any known remote. - - The scan is blocked when the transfer queue gets too large. -} expensiveScan :: ThreadState -> DaemonStatusHandle -> TransferQueue -> [Remote] -> IO () @@ -114,7 +114,11 @@ expensiveScan st dstatus transferqueue rs = unless onlyweb $ do queueTransferWhenSmall transferqueue dstatus (Just f) t r findtransfers f (key, _) = do locs <- loggedLocations key - let use a = return $ catMaybes $ map (a key locs) rs + {- Queue transfers from any known remote. The known + - remotes may have changed since this scan began. -} + let use a = do + knownrs <- liftIO $ knownRemotes <$> getDaemonStatus dstatus + return $ catMaybes $ map (a key locs) knownrs ifM (inAnnex key) ( filterM (wantSend (Just f) . Remote.uuid . fst) =<< use (check Upload False) -- cgit v1.2.3