
Added a RemoteChecker thread, that waits for problems to be reported with remotes, and checks if their git repository is in need of repair. Currently, only failures to sync with the remote cause a problem to be reported. This seems enough, but we'll see. Plugging in a removable drive with a repository on it that is corrupted does automatically repair the repository, as long as the corruption causes git push or git pull to fail. Some types of corruption do not, eg missing/corrupt objects for blobs that git push doesn't need to look at. So, this is not really a replacement for scheduled git repository fscking. But it does make the assistant more robust. This commit is sponsored by Fernando Jimenez.
23 lines
722 B
Haskell
23 lines
722 B
Haskell
{- git-annex assistant remote problem handling
|
|
-
|
|
- Copyright 2013 Joey Hess <joey@kitenet.net>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module Assistant.RemoteProblem where
|
|
|
|
import Assistant.Common
|
|
import Utility.TList
|
|
|
|
import Control.Concurrent.STM
|
|
|
|
{- Gets all remotes that have problems.
|
|
- Blocks until there is at least one. -}
|
|
getRemoteProblems :: Assistant [Remote]
|
|
getRemoteProblems = (atomically . getTList) <<~ remoteProblemChan
|
|
|
|
{- Indicates that there was a problem accessing a remote, and the problem
|
|
- appears to not be a transient (eg network connection) problem. -}
|
|
remoteHasProblem :: Remote -> Assistant ()
|
|
remoteHasProblem r = (atomically . flip consTList r) <<~ remoteProblemChan
|