From c8cd4ec3082ac7dd24c0377d66c95cb05b51f0ba Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 28 Oct 2012 16:05:34 -0400 Subject: ensure that git-annex branch is pushed after a successful transfer I now have this topology working: assistant ---> {bare repo, special remote} <--- assistant And, I think, also this one: +----------- bare repo --------+ v v assistant ---> special remote <--- assistant While before with assistant <---> assistant connections, both sides got location info updated after a transfer, in this topology, the bare repo *might* get its location info updated, but the other assistant has no way to know that it did. And a special remote doesn't record location info, so transfers to it won't propigate out location log changes at all. So, for these to work, after a transfer succeeds, the git-annex branch needs to be pushed. This is done by recording a synthetic commit has occurred, which lets the pusher handle pushing out the change (which will include actually committing any still journalled changes to the git-annex branch). Of course, this means rather a lot more syncing action than happened before. At least the pusher bundles together very close together pushes, somewhat. Currently it just waits 2 seconds between each push. --- Assistant/Threads/Pusher.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Assistant/Threads/Pusher.hs') diff --git a/Assistant/Threads/Pusher.hs b/Assistant/Threads/Pusher.hs index 295ceddc9..671a620b4 100644 --- a/Assistant/Threads/Pusher.hs +++ b/Assistant/Threads/Pusher.hs @@ -49,12 +49,12 @@ pushThread st dstatus commitchan pushmap pushnotifier = thread $ runEvery (Secon -- Next, wait until at least one commit has been made commits <- getCommits commitchan -- Now see if now's a good time to push. - now <- getCurrentTime - if shouldPush now commits + if shouldPush commits then do remotes <- filter pushable . syncRemotes <$> getDaemonStatus dstatus - unless (null remotes) $ + unless (null remotes) $ do + now <- getCurrentTime void $ alertWhile dstatus (pushAlert remotes) $ pushToRemotes thisThread now st (Just pushnotifier) (Just pushmap) remotes else do @@ -77,7 +77,7 @@ pushThread st dstatus commitchan pushmap pushnotifier = thread $ runEvery (Secon - already determines batches of changes, so we can't easily determine - batches better. -} -shouldPush :: UTCTime -> [Commit] -> Bool -shouldPush _now commits +shouldPush :: [Commit] -> Bool +shouldPush commits | not (null commits) = True | otherwise = False -- cgit v1.2.3