summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-04-07 13:59:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-04-07 13:59:31 -0400
commitbc51387e6dd426f46f9ab0ef23e6e3eefe7a4417 (patch)
tree9627f60c81d1852b731ea57171f4b36887847e9b /CmdLine.hs
parent77f45e4e45d45a08bfe1bec210909345adb6f6d8 (diff)
Periodically flush git command queue, to avoid boating memory usage too much.
Since the queue is flushed in between subcommand actions being run, there should be no issues with actions that expect to queue up some stuff and have it run after they do other stuff. So I didn't have to audit for such assumptions.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index de03d96ed..684ebf979 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -14,11 +14,11 @@ module CmdLine (
import System.IO.Error (try)
import System.Console.GetOpt
import Control.Monad.State (liftIO)
-import Control.Monad (when, unless)
+import Control.Monad (when)
import qualified Annex
+import qualified AnnexQueue
import qualified GitRepo as Git
-import qualified GitQueue
import Types
import Command
import BackendList
@@ -81,7 +81,9 @@ tryRun :: Annex.AnnexState -> [Annex Bool] -> IO ()
tryRun state actions = tryRun' state 0 actions
tryRun' :: Annex.AnnexState -> Integer -> [Annex Bool] -> IO ()
tryRun' state errnum (a:as) = do
- result <- try $ Annex.run state a
+ result <- try $ Annex.run state $ do
+ AnnexQueue.flushWhenFull
+ a
case result of
Left err -> do
Annex.eval state $ showErr err
@@ -100,10 +102,7 @@ startup = do
{- Cleanup actions. -}
shutdown :: Annex Bool
shutdown = do
- q <- Annex.getState Annex.repoqueue
- unless (0 == GitQueue.size q) $ do
- showSideAction "Recording state in git..."
- Annex.queueRun
+ AnnexQueue.flush False
liftIO $ Git.reap