diff --git a/Assistant/MakeRemote.hs b/Assistant/MakeRemote.hs index 8665853196..33ca0b2c0e 100644 --- a/Assistant/MakeRemote.hs +++ b/Assistant/MakeRemote.hs @@ -32,7 +32,7 @@ makeSshRemote forcersync sshdata mcost = do r <- liftAnnex $ addRemote $ maker (sshRepoName sshdata) sshurl liftAnnex $ maybe noop (setRemoteCost r) mcost - syncNewRemote r + syncRemote r return r where rsync = forcersync || rsyncOnly sshdata diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs index 50e8e73212..78fdbab1a8 100644 --- a/Assistant/Sync.hs +++ b/Assistant/Sync.hs @@ -204,9 +204,9 @@ manualPull currentbranch remotes = do sendNetMessage $ Pushing (getXMPPClientID r) PushRequest return (catMaybes failed, haddiverged) -{- Start syncing a newly added remote, using a background thread. -} -syncNewRemote :: Remote -> Assistant () -syncNewRemote remote = do +{- Start syncing a remote, using a background thread. -} +syncRemote :: Remote -> Assistant () +syncRemote remote = do updateSyncRemotes thread <- asIO $ do reconnectRemotes False [remote] diff --git a/Assistant/WebApp/Configurators/AWS.hs b/Assistant/WebApp/Configurators/AWS.hs index 9fb825471e..877e845767 100644 --- a/Assistant/WebApp/Configurators/AWS.hs +++ b/Assistant/WebApp/Configurators/AWS.hs @@ -191,7 +191,7 @@ makeAWSRemote remotetype (AWSCreds ak sk) name setup config = do makeSpecialRemote hostname remotetype config return remotename setup r - liftAssistant $ syncNewRemote r + liftAssistant $ syncRemote r redirect $ EditNewCloudRepositoryR $ Remote.uuid r where {- AWS services use the remote name as the basis for a host diff --git a/Assistant/WebApp/Configurators/Local.hs b/Assistant/WebApp/Configurators/Local.hs index d94f592699..ed3bca5777 100644 --- a/Assistant/WebApp/Configurators/Local.hs +++ b/Assistant/WebApp/Configurators/Local.hs @@ -10,9 +10,9 @@ module Assistant.WebApp.Configurators.Local where import Assistant.WebApp.Common -import Assistant.WebApp.Utility import Assistant.WebApp.OtherRepos import Assistant.MakeRemote +import Assistant.Sync import Init import qualified Git import qualified Git.Construct @@ -166,7 +166,7 @@ postNewRepositoryR = page "Add another repository" (Just Configuration) $ do getCombineRepositoryR :: FilePathAndUUID -> Handler RepHtml getCombineRepositoryR (FilePathAndUUID newrepopath newrepouuid) = do r <- combineRepos newrepopath remotename - syncRemote r + liftAssistant $ syncRemote r redirect $ EditRepositoryR newrepouuid where remotename = takeFileName newrepopath @@ -244,7 +244,7 @@ getFinishAddDriveR drive = make >>= redirect . EditNewRepositoryR u <- liftIO $ initRepo isnew False dir $ Just remotename r <- combineRepos dir remotename liftAnnex $ setStandardGroup u TransferGroup - syncRemote r + liftAssistant $ syncRemote r return u mountpoint = T.unpack (mountPoint drive) dir = removableDriveRepository drive diff --git a/Assistant/WebApp/Configurators/WebDAV.hs b/Assistant/WebApp/Configurators/WebDAV.hs index 6108f8bd83..cad75f2e9b 100644 --- a/Assistant/WebApp/Configurators/WebDAV.hs +++ b/Assistant/WebApp/Configurators/WebDAV.hs @@ -128,6 +128,6 @@ makeWebDavRemote name creds setup config = do makeSpecialRemote name WebDAV.remote config return remotename setup r - liftAssistant $ syncNewRemote r + liftAssistant $ syncRemote r redirect $ EditNewCloudRepositoryR $ Remote.uuid r #endif diff --git a/Assistant/WebApp/Utility.hs b/Assistant/WebApp/Utility.hs index b619cf87c0..0dd82a0919 100644 --- a/Assistant/WebApp/Utility.hs +++ b/Assistant/WebApp/Utility.hs @@ -44,7 +44,7 @@ changeSyncable Nothing enable = do | otherwise = PauseWatcher changeSyncable (Just r) True = do changeSyncFlag r True - syncRemote r + liftAssistant $ syncRemote r changeSyncable (Just r) False = do changeSyncFlag r False liftAssistant $ updateSyncRemotes @@ -64,10 +64,6 @@ changeSyncFlag r enabled = liftAnnex $ do where key = Config.remoteConfig (Remote.repo r) "sync" -{- Start syncing remote, using a background thread. -} -syncRemote :: Remote -> Handler () -syncRemote = liftAssistant . syncNewRemote - pauseTransfer :: Transfer -> Handler () pauseTransfer = cancelTransfer True diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index f90af40805..4fd878a9e2 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -60,7 +60,7 @@ makeXMPPGitRemote buddyname jid u = do liftAnnex $ void remoteListRefresh remote' <- liftAnnex $ fromMaybe (error "failed to add remote") <$> Remote.byName (Just buddyname) - syncNewRemote remote' + syncRemote remote' return True {- Pushes over XMPP, communicating with a specific client.