diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-22 14:32:17 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-22 14:32:17 -0400 |
commit | 68659f49983ca30a3c1a1a3f5e7da003f96741dc (patch) | |
tree | 31e100dcd657840b9628b043681bdd4a7e48e1c1 /Assistant/Threads/NetWatcher.hs | |
parent | 5a68acb521bae0277b2c8a8ca023dc57a5ff4b33 (diff) |
refactor
Diffstat (limited to 'Assistant/Threads/NetWatcher.hs')
-rw-r--r-- | Assistant/Threads/NetWatcher.hs | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/Assistant/Threads/NetWatcher.hs b/Assistant/Threads/NetWatcher.hs index d871a4791..ffe9e1e0a 100644 --- a/Assistant/Threads/NetWatcher.hs +++ b/Assistant/Threads/NetWatcher.hs @@ -14,17 +14,13 @@ import Assistant.Common import Assistant.ThreadedMonad import Assistant.DaemonStatus import Assistant.ScanRemotes -import Assistant.Threads.Pusher (pushToRemotes) -import Assistant.Alert +import Assistant.Sync import qualified Git import Utility.ThreadScheduler import Remote.List import qualified Types.Remote as Remote -import Assistant.Threads.Merger -import qualified Git.Branch import qualified Control.Exception as E -import Data.Time.Clock #if WITH_DBUS import Utility.DBus @@ -128,20 +124,9 @@ pollingThread st dstatus scanremotes = runEvery (Seconds 3600) $ handleConnection :: ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> IO () handleConnection st dstatus scanremotes = do - rs <- networkRemotes st - unless (null rs) $ do - let nonspecial = filter (Git.repoIsUrl . Remote.repo) rs - unless (null nonspecial) $ do - void $ alertWhile dstatus (syncAlert nonspecial) $ do - debug thisThread ["syncing with", show nonspecial] - sync nonspecial =<< runThreadState st (inRepo Git.Branch.current) - addScanRemotes scanremotes nonspecial - where - sync rs (Just branch) = do - runThreadState st $ manualPull (Just branch) rs - now <- getCurrentTime - pushToRemotes thisThread now st Nothing rs - sync _ _ = return True + syncRemotes thisThread st dstatus scanremotes =<< + filter (Git.repoIsUrl . Remote.repo) + <$> networkRemotes st {- Finds network remotes. -} networkRemotes :: ThreadState -> IO [Remote] |