summaryrefslogtreecommitdiff
path: root/Assistant/Threads/SanityChecker.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-20 19:29:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-20 19:29:59 -0400
commitb48d7747a3ac8bea7d58e8fff8faf791f98699c0 (patch)
treef5662f9161fd3c74c2f6467be270651d92ac3ead /Assistant/Threads/SanityChecker.hs
parent42e73537d1977eac2da2760647e9131f5c9b9eed (diff)
debugging improvements
add timestamps to debug messages Add lots of debug output in the assistant's threads.
Diffstat (limited to 'Assistant/Threads/SanityChecker.hs')
-rw-r--r--Assistant/Threads/SanityChecker.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs
index c5b99863e..09aee0797 100644
--- a/Assistant/Threads/SanityChecker.hs
+++ b/Assistant/Threads/SanityChecker.hs
@@ -9,22 +9,27 @@ module Assistant.Threads.SanityChecker (
sanityCheckerThread
) where
-import Common.Annex
-import qualified Git.LsFiles
+import Assistant.Common
import Assistant.DaemonStatus
import Assistant.ThreadedMonad
import Assistant.Changes
import Assistant.TransferQueue
+import qualified Git.LsFiles
import Utility.ThreadScheduler
import qualified Assistant.Threads.Watcher as Watcher
import Data.Time.Clock.POSIX
+thisThread :: ThreadName
+thisThread = "SanityChecker"
+
{- This thread wakes up occasionally to make sure the tree is in good shape. -}
sanityCheckerThread :: ThreadState -> DaemonStatusHandle -> TransferQueue -> ChangeChan -> IO ()
sanityCheckerThread st status transferqueue changechan = forever $ do
waitForNextCheck st status
+ debug thisThread ["starting sanity check"]
+
runThreadState st $
modifyDaemonStatus_ status $ \s -> s
{ sanityCheckRunning = True }
@@ -38,6 +43,9 @@ sanityCheckerThread st status transferqueue changechan = forever $ do
{ sanityCheckRunning = False
, lastSanityCheck = Just now
}
+
+ debug thisThread ["sanity check complete"]
+
{- Only run one check per day, from the time of the last check. -}
waitForNextCheck :: ThreadState -> DaemonStatusHandle -> IO ()
@@ -80,5 +88,6 @@ check st status transferqueue changechan = do
insanity m = runThreadState st $ warning m
addsymlink file s = do
insanity $ "found unstaged symlink: " ++ file
- Watcher.runHandler st status transferqueue changechan
+ Watcher.runHandler thisThread st status
+ transferqueue changechan
Watcher.onAddSymlink file s