diff options
-rw-r--r-- | Assistant/DaemonStatus.hs | 9 | ||||
-rw-r--r-- | Assistant/Threads/Pusher.hs | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs index 4a9dfb4e2..4077eec88 100644 --- a/Assistant/DaemonStatus.hs +++ b/Assistant/DaemonStatus.hs @@ -14,7 +14,7 @@ import Utility.ThreadScheduler import Utility.TempFile import Utility.NotificationBroadcaster import Logs.Transfer -import qualified Command.Sync +import qualified Remote import Control.Concurrent.STM import System.Posix.Types @@ -81,11 +81,14 @@ modifyDaemonStatus dstatus a = do sendNotification $ changeNotifier s return b +calcKnownRemotes :: Annex [Remote] +calcKnownRemotes = concat . Remote.byCost <$> Remote.enabledRemoteList + {- Updates the cached ordered list of remotes from the list in Annex - state. -} updateKnownRemotes :: DaemonStatusHandle -> Annex () updateKnownRemotes dstatus = do - remotes <- Command.Sync.syncRemotes [] + remotes <- calcKnownRemotes liftIO $ modifyDaemonStatus_ dstatus $ \s -> s { knownRemotes = remotes } @@ -97,7 +100,7 @@ startDaemonStatus = do status <- liftIO $ catchDefaultIO (readDaemonStatusFile file) =<< newDaemonStatus transfers <- M.fromList <$> getTransfers - remotes <- Command.Sync.syncRemotes [] + remotes <- calcKnownRemotes liftIO $ atomically $ newTMVar status { scanComplete = False , sanityCheckRunning = False diff --git a/Assistant/Threads/Pusher.hs b/Assistant/Threads/Pusher.hs index 4b80297fa..73bf24ede 100644 --- a/Assistant/Threads/Pusher.hs +++ b/Assistant/Threads/Pusher.hs @@ -15,6 +15,7 @@ import Assistant.ThreadedMonad import Assistant.DaemonStatus import Assistant.Sync import Utility.ThreadScheduler +import qualified Remote import Data.Time.Clock @@ -50,7 +51,8 @@ pushThread st dstatus commitchan pushmap = do now <- getCurrentTime if shouldPush now commits then do - remotes <- knownRemotes <$> getDaemonStatus dstatus + remotes <- filter (not . Remote.specialRemote) . + knownRemotes <$> getDaemonStatus dstatus unless (null remotes) $ void $ alertWhile dstatus (pushAlert remotes) $ pushToRemotes thisThread now st (Just pushmap) remotes |