summaryrefslogtreecommitdiff
path: root/Assistant/Changes.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-29 09:55:40 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-29 09:55:40 -0400
commit710dfa7e3ec897d6f02930540b10bb303e3a9c91 (patch)
tree5f046ee72ac000008b1e4c7853d5c3a788ec802e /Assistant/Changes.hs
parent579f63b6b756ca51b8f9fe53c3e668500718d91f (diff)
convert Watcher thread to Assistant monad
This is a nice win; much less code runs in Annex, so other threads have more chances to run concurrently. I do notice that renaming a file has gone from 1 to 2 commits. I think this is due to the above improvement letting the committer run more frequently, so it commits the rm first.
Diffstat (limited to 'Assistant/Changes.hs')
-rw-r--r--Assistant/Changes.hs15
1 files changed, 5 insertions, 10 deletions
diff --git a/Assistant/Changes.hs b/Assistant/Changes.hs
index cccc372c1..b20dce09a 100644
--- a/Assistant/Changes.hs
+++ b/Assistant/Changes.hs
@@ -8,7 +8,6 @@
module Assistant.Changes where
import Common.Annex
-import qualified Annex.Queue
import Types.KeySource
import Utility.TSet
@@ -39,19 +38,15 @@ newChangeChan :: IO ChangeChan
newChangeChan = newTSet
{- Handlers call this when they made a change that needs to get committed. -}
-madeChange :: FilePath -> ChangeType -> Annex (Maybe Change)
-madeChange f t = do
- -- Just in case the commit thread is not flushing the queue fast enough.
- Annex.Queue.flushWhenFull
- liftIO $ Just <$> (Change <$> getCurrentTime <*> pure f <*> pure t)
+madeChange :: FilePath -> ChangeType -> IO (Maybe Change)
+madeChange f t = Just <$> (Change <$> getCurrentTime <*> pure f <*> pure t)
-noChange :: Annex (Maybe Change)
+noChange :: IO (Maybe Change)
noChange = return Nothing
{- Indicates an add needs to be done, but has not started yet. -}
-pendingAddChange :: FilePath -> Annex (Maybe Change)
-pendingAddChange f =
- liftIO $ Just <$> (PendingAddChange <$> getCurrentTime <*> pure f)
+pendingAddChange :: FilePath -> IO (Maybe Change)
+pendingAddChange f = Just <$> (PendingAddChange <$> getCurrentTime <*> pure f)
isPendingAddChange :: Change -> Bool
isPendingAddChange (PendingAddChange {}) = True