summaryrefslogtreecommitdiff
path: root/Assistant/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-23 15:22:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-23 15:24:15 -0400
commit715a9a2f8e788ffe0bc92bc02919a1825bda49a7 (patch)
tree259e5e683f7d7db3f6bba0192638fe77eeb36d05 /Assistant/Sync.hs
parent487bdf0e24d34135da2e53bbcd2c97d892ed817a (diff)
keep logs of failed transfers, and requeue them when doing a non-full scan
of a remote
Diffstat (limited to 'Assistant/Sync.hs')
-rw-r--r--Assistant/Sync.hs19
1 files changed, 9 insertions, 10 deletions
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs
index 42f82e9ab..6a586e097 100644
--- a/Assistant/Sync.hs
+++ b/Assistant/Sync.hs
@@ -26,10 +26,11 @@ import qualified Data.Map as M
{- Syncs with remotes that may have been disconnected for a while.
-
- - After getting git in sync, queues a scan for file transfers.
- - To avoid doing that expensive scan unnecessarily, it's only run
- - if the git-annex branches of the remotes have diverged from the
- - local git-annex branch.
+ - First gets git in sync, and then prepares any necessary file transfers.
+ -
+ - An expensive full scan is queued when the git-annex branches of the
+ - remotes have diverged from the local git-annex branch. Otherwise,
+ - it's sufficient to requeue failed transfers.
-}
reconnectRemotes :: ThreadName -> ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> [Remote] -> IO ()
reconnectRemotes _ _ _ _ [] = noop
@@ -38,16 +39,14 @@ reconnectRemotes threadname st dstatus scanremotes rs = void $
sync =<< runThreadState st (inRepo Git.Branch.current)
where
sync (Just branch) = do
- haddiverged <- manualPull st (Just branch) rs
- when haddiverged $
- addScanRemotes scanremotes rs
+ diverged <- manualPull st (Just branch) rs
+ addScanRemotes scanremotes rs diverged
now <- getCurrentTime
pushToRemotes threadname now st Nothing rs
{- No local branch exists yet, but we can try pulling. -}
sync Nothing = do
- haddiverged <- manualPull st Nothing rs
- when haddiverged $
- addScanRemotes scanremotes rs
+ diverged <- manualPull st Nothing rs
+ addScanRemotes scanremotes rs diverged
return True
{- Updates the local sync branch, then pushes it to all remotes, in