diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-29 16:22:14 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-29 16:22:14 -0400 |
commit | 47f4506a1ed1d98d3bdae0de24e00f2eb64611da (patch) | |
tree | 384a5b97fb6710d19c4c26a43d6f364dedf4d4a3 /Assistant/Threads | |
parent | f62e5c41e4621940a863b35c9c54e0626587a694 (diff) |
lifted Assistant.Sync into Assistant monad
lots of nice cleanups
Diffstat (limited to 'Assistant/Threads')
-rw-r--r-- | Assistant/Threads/MountWatcher.hs | 6 | ||||
-rw-r--r-- | Assistant/Threads/NetWatcher.hs | 6 | ||||
-rw-r--r-- | Assistant/Threads/Pusher.hs | 13 |
3 files changed, 6 insertions, 19 deletions
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs index 8814f7a86..503f9b76c 100644 --- a/Assistant/Threads/MountWatcher.hs +++ b/Assistant/Threads/MountWatcher.hs @@ -159,11 +159,7 @@ handleMount :: FilePath -> Assistant () handleMount dir = do debug ["detected mount of", dir] rs <- filter (Git.repoIsLocal . Remote.repo) <$> remotesUnder dir - d <- getAssistant id - liftIO $ - reconnectRemotes (threadName d) (threadState d) - (daemonStatusHandle d) (scanRemoteMap d) - (Just $ pushNotifier d) rs + reconnectRemotes True rs {- Finds remotes located underneath the mount point. - diff --git a/Assistant/Threads/NetWatcher.hs b/Assistant/Threads/NetWatcher.hs index 2af880e02..12e764016 100644 --- a/Assistant/Threads/NetWatcher.hs +++ b/Assistant/Threads/NetWatcher.hs @@ -123,11 +123,7 @@ listenWicdConnections client callback = #endif handleConnection :: Assistant () -handleConnection = do - d <- getAssistant id - liftIO . reconnectRemotes (threadName d) (threadState d) - (daemonStatusHandle d) (scanRemoteMap d) (Just $ pushNotifier d) - =<< networkRemotes +handleConnection = reconnectRemotes True =<< networkRemotes {- Finds network remotes. -} networkRemotes :: Assistant [Remote] diff --git a/Assistant/Threads/Pusher.hs b/Assistant/Threads/Pusher.hs index 811314651..0235e6efc 100644 --- a/Assistant/Threads/Pusher.hs +++ b/Assistant/Threads/Pusher.hs @@ -32,11 +32,9 @@ pushRetryThread = NamedThread "PushRetrier" $ runEvery (Seconds halfhour) <~> do unless (null topush) $ do debug ["retrying", show (length topush), "failed pushes"] now <- liftIO $ getCurrentTime - st <- getAssistant threadState - pushnotifier <- getAssistant pushNotifier dstatus <- getAssistant daemonStatusHandle - void $ liftIO $ alertWhile dstatus (pushRetryAlert topush) $ - pushToRemotes thisThread now st (Just pushnotifier) (Just pushmap) topush + void $ alertWhile dstatus (pushRetryAlert topush) <~> + pushToRemotes now True topush where halfhour = 1800 @@ -52,12 +50,9 @@ pushThread = NamedThread "Pusher" $ runEvery (Seconds 2) <~> do remotes <- filter pushable . syncRemotes <$> daemonStatus unless (null remotes) $ do now <- liftIO $ getCurrentTime - st <- getAssistant threadState - pushmap <- getAssistant failedPushMap - pushnotifier <- getAssistant pushNotifier dstatus <- getAssistant daemonStatusHandle - void $ liftIO $ alertWhile dstatus (pushAlert remotes) $ - pushToRemotes thisThread now st (Just pushnotifier) (Just pushmap) remotes + void $ alertWhile dstatus (pushAlert remotes) <~> + pushToRemotes now True remotes else do debug ["delaying push of", show (length commits), "commits"] flip refillCommits commits <<~ commitChan |