aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-10-13 17:14:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-10-13 17:14:56 -0400
commit7e226e373b203dce324b9d3b7fc2a82ca1781183 (patch)
tree50cf3d083441c4a99d4e46f95a66421e1e1d2a4a /Assistant/Sync.hs
parenta0865e6c494ec4bdfb7ab058a5633a8634d48bd4 (diff)
cronner: run jobs triggered by remotes becoming connected (untested)
Diffstat (limited to 'Assistant/Sync.hs')
-rw-r--r--Assistant/Sync.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs
index fe578ab43..fe4fda896 100644
--- a/Assistant/Sync.hs
+++ b/Assistant/Sync.hs
@@ -44,13 +44,17 @@ import Control.Concurrent
- they push to us. Since XMPP pushes run ansynchronously, any scan of the
- XMPP remotes has to be deferred until they're done pushing to us, so
- all XMPP remotes are marked as possibly desynced.
+ -
+ - Also handles signaling any connectRemoteNotifiers, after the syncing is
+ - done.
-}
reconnectRemotes :: Bool -> [Remote] -> Assistant ()
reconnectRemotes _ [] = noop
reconnectRemotes notifypushes rs = void $ do
modifyDaemonStatus_ $ \s -> s
{ desynced = S.union (S.fromList $ map Remote.uuid xmppremotes) (desynced s) }
- syncAction rs (const go)
+ void $ syncAction rs (const go)
+ mapM_ signal rs
where
gitremotes = filter (notspecialremote . Remote.repo) rs
(xmppremotes, nonxmppremotes) = partition isXMPPRemote rs
@@ -73,6 +77,9 @@ reconnectRemotes notifypushes rs = void $ do
filter (not . remoteAnnexIgnore . Remote.gitconfig)
nonxmppremotes
return failed
+ signal r = liftIO . mapM_ (flip tryPutMVar ())
+ =<< fromMaybe [] . M.lookup (Remote.uuid r) . connectRemoteNotifiers
+ <$> getDaemonStatus
{- Updates the local sync branch, then pushes it to all remotes, in
- parallel, along with the git-annex branch. This is the same