summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-15 19:17:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-15 19:17:21 -0400
commit59abd787c948ef7a6bda3b62be9024212eb69a46 (patch)
treeaa3da7541280782fdd047e9f3544177706224704 /Assistant
parent679ef4c85896b6830bc6ae335995558577f4e435 (diff)
can't wait for LinkChanges specifically
There is indeed a race waiting for LinkChanges: 1. file annexed, link made 2. link deleted 3. inotify event for link creation runs, but as link is gone, handler is not run
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Committer.hs19
1 files changed, 4 insertions, 15 deletions
diff --git a/Assistant/Committer.hs b/Assistant/Committer.hs
index 64ea300e2..71152e5e9 100644
--- a/Assistant/Committer.hs
+++ b/Assistant/Committer.hs
@@ -84,23 +84,20 @@ commitThread st changechan = runEvery (Seconds 1) $ do
- for write by some other process.
-
- When a file is added, Inotify will notice the new symlink. So this waits
- - for one new LinkChange to be received per file that's successfully
- - added, to ensure that its symlink has been staged before returning.
+ - for additional Changes to arrive, so that the symlink has hopefully been
+ - staged before returning.
-}
handleAdds :: ThreadState -> ChangeChan -> [Change] -> IO ()
handleAdds st changechan cs
| null added = noop
| otherwise = do
- r <- forM added $ catchBoolIO . runThreadState st . add
- let numadded = length $ filter id r
- handleAdds st changechan =<< waitforlinkchanges [] numadded
+ forM_ added $ catchBoolIO . runThreadState st . add
+ handleAdds st changechan =<< getChanges changechan
where
added = map changeFile $ filter isPendingAdd cs
isPendingAdd (Change { changeType = PendingAddChange }) = True
isPendingAdd _ = False
- isLinkChange (Change { changeType = LinkChange }) = True
- isLinkChange _ = False
add file = do
showStart "add" file
@@ -114,14 +111,6 @@ handleAdds st changechan cs
showEndOk
return True
- waitforlinkchanges c n
- | n < 1 = return $ concat c
- | otherwise = do
- (done, rest) <- partition isLinkChange
- <$> getChanges changechan
- let n' = (n - length done)
- waitforlinkchanges (rest:c) n'
-
commitStaged :: Annex ()
commitStaged = do
Annex.Queue.flush