aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Threads/SanityChecker.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-03 13:39:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-03 13:44:35 -0400
commit5dcd5c82ef47fa121e9800835fc399d5ecdc3af3 (patch)
treed96d1020173dd3016bbc6b2ae6ed3d36133a4607 /Assistant/Threads/SanityChecker.hs
parent9bce151df7b073c5f2507ea15ca2237814ae9248 (diff)
assistant: Prevent automatic commits from causing git-gc runs, as that can make things quite slow. Instead, git-gc --auto is run once a day. (This can be disabled by the usual gc.auto=0 setting.)
Diffstat (limited to 'Assistant/Threads/SanityChecker.hs')
-rw-r--r--Assistant/Threads/SanityChecker.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs
index 0a1b15699..806441058 100644
--- a/Assistant/Threads/SanityChecker.hs
+++ b/Assistant/Threads/SanityChecker.hs
@@ -14,6 +14,7 @@ import Assistant.Common
import Assistant.DaemonStatus
import Assistant.Alert
import qualified Git.LsFiles
+import qualified Git.Command
import Utility.ThreadScheduler
import qualified Assistant.Threads.Watcher as Watcher
import Utility.LogFile
@@ -71,6 +72,7 @@ waitForNextCheck = do
dailyCheck :: Assistant Bool
dailyCheck = do
g <- liftAnnex gitRepo
+
-- Find old unstaged symlinks, and add them to git.
(unstaged, cleanup) <- liftIO $ Git.LsFiles.notInRepo False ["."] g
now <- liftIO $ getPOSIXTime
@@ -81,6 +83,11 @@ dailyCheck = do
| isSymbolicLink s -> addsymlink file ms
_ -> noop
liftIO $ void cleanup
+
+ {- Allow git-gc to run once per day. More frequent gc is avoided
+ - to avoid slowing things down. -}
+ void $ liftIO $ Git.Command.runBool [Param "gc", Param "--auto"] g
+
return True
where
toonew timestamp now = now < (realToFrac (timestamp + slop) :: POSIXTime)