diff options
author | 2013-10-29 13:41:44 -0400 | |
---|---|---|
committer | 2013-10-29 13:41:44 -0400 | |
commit | 2db78797ee58e53f06bd2d104fb203c45247e7c0 (patch) | |
tree | 3b8b7ab10eeb2cb8c787a6d57c1a03bb623ece6a /Assistant/Threads/RemoteChecker.hs | |
parent | 255354acc20f2680126b22cc02a0893d1d72d804 (diff) |
move code around and rename thread; no functional changes
Diffstat (limited to 'Assistant/Threads/RemoteChecker.hs')
-rw-r--r-- | Assistant/Threads/RemoteChecker.hs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/Assistant/Threads/RemoteChecker.hs b/Assistant/Threads/RemoteChecker.hs deleted file mode 100644 index ea0b578d2..000000000 --- a/Assistant/Threads/RemoteChecker.hs +++ /dev/null @@ -1,46 +0,0 @@ -{- git-annex assistant remote checker thread - - - - Copyright 2013 Joey Hess <joey@kitenet.net> - - - - Licensed under the GNU GPL version 3 or higher. - -} - -module Assistant.Threads.RemoteChecker ( - remoteCheckerThread -) where - -import Assistant.Common -import Utility.ThreadScheduler -import Assistant.Types.UrlRenderer -import Assistant.Alert -import Remote -import qualified Types.Remote as Remote -import qualified Git.Fsck -import Assistant.Repair -import qualified Git -import Assistant.RemoteProblem -import Assistant.Sync - -import Data.Function - -{- Waits for problems with remotes, and tries to fsck the remote and repair - - the problem. -} -remoteCheckerThread :: UrlRenderer -> NamedThread -remoteCheckerThread urlrenderer = namedThread "RemoteChecker" $ forever $ do - mapM_ (handleProblem urlrenderer) - =<< liftIO . filterM (checkAvailable True) - =<< nubremotes <$> getRemoteProblems - liftIO $ threadDelaySeconds (Seconds 60) - where - nubremotes = nubBy ((==) `on` Remote.uuid) - -handleProblem :: UrlRenderer -> Remote -> Assistant () -handleProblem urlrenderer rmt - | Git.repoIsLocal r && not (Git.repoIsLocalUnknown r) = do - fsckresults <- showFscking urlrenderer (Just $ Remote.name rmt) $ tryNonAsync $ - Git.Fsck.findBroken True r - whenM (repairWhenNecessary urlrenderer (Remote.uuid rmt) (Just rmt) fsckresults) $ - syncRemote rmt - | otherwise = noop - where - r = Remote.repo rmt |