don't exclude special remotes from the knownRemotes list used by the assistant

But do exclude them when pushing out changes.
This commit is contained in:
Joey Hess 2012-08-26 14:56:26 -04:00
parent c58d553265
commit 4d269db520
2 changed files with 9 additions and 4 deletions
Assistant

View file

@ -14,7 +14,7 @@ import Utility.ThreadScheduler
import Utility.TempFile import Utility.TempFile
import Utility.NotificationBroadcaster import Utility.NotificationBroadcaster
import Logs.Transfer import Logs.Transfer
import qualified Command.Sync import qualified Remote
import Control.Concurrent.STM import Control.Concurrent.STM
import System.Posix.Types import System.Posix.Types
@ -81,11 +81,14 @@ modifyDaemonStatus dstatus a = do
sendNotification $ changeNotifier s sendNotification $ changeNotifier s
return b return b
calcKnownRemotes :: Annex [Remote]
calcKnownRemotes = concat . Remote.byCost <$> Remote.enabledRemoteList
{- Updates the cached ordered list of remotes from the list in Annex {- Updates the cached ordered list of remotes from the list in Annex
- state. -} - state. -}
updateKnownRemotes :: DaemonStatusHandle -> Annex () updateKnownRemotes :: DaemonStatusHandle -> Annex ()
updateKnownRemotes dstatus = do updateKnownRemotes dstatus = do
remotes <- Command.Sync.syncRemotes [] remotes <- calcKnownRemotes
liftIO $ modifyDaemonStatus_ dstatus $ liftIO $ modifyDaemonStatus_ dstatus $
\s -> s { knownRemotes = remotes } \s -> s { knownRemotes = remotes }
@ -97,7 +100,7 @@ startDaemonStatus = do
status <- liftIO $ status <- liftIO $
catchDefaultIO (readDaemonStatusFile file) =<< newDaemonStatus catchDefaultIO (readDaemonStatusFile file) =<< newDaemonStatus
transfers <- M.fromList <$> getTransfers transfers <- M.fromList <$> getTransfers
remotes <- Command.Sync.syncRemotes [] remotes <- calcKnownRemotes
liftIO $ atomically $ newTMVar status liftIO $ atomically $ newTMVar status
{ scanComplete = False { scanComplete = False
, sanityCheckRunning = False , sanityCheckRunning = False

View file

@ -15,6 +15,7 @@ import Assistant.ThreadedMonad
import Assistant.DaemonStatus import Assistant.DaemonStatus
import Assistant.Sync import Assistant.Sync
import Utility.ThreadScheduler import Utility.ThreadScheduler
import qualified Remote
import Data.Time.Clock import Data.Time.Clock
@ -50,7 +51,8 @@ pushThread st dstatus commitchan pushmap = do
now <- getCurrentTime now <- getCurrentTime
if shouldPush now commits if shouldPush now commits
then do then do
remotes <- knownRemotes <$> getDaemonStatus dstatus remotes <- filter (not . Remote.specialRemote) .
knownRemotes <$> getDaemonStatus dstatus
unless (null remotes) $ unless (null remotes) $
void $ alertWhile dstatus (pushAlert remotes) $ void $ alertWhile dstatus (pushAlert remotes) $
pushToRemotes thisThread now st (Just pushmap) remotes pushToRemotes thisThread now st (Just pushmap) remotes