run sync in background
This commit is contained in:
parent
e6f61e5ab9
commit
6623a51cf9
1 changed files with 3 additions and 2 deletions
|
@ -37,6 +37,7 @@ import qualified Data.Text as T
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import System.Posix.Directory
|
import System.Posix.Directory
|
||||||
import qualified Control.Exception as E
|
import qualified Control.Exception as E
|
||||||
|
import Control.Concurrent
|
||||||
|
|
||||||
data RepositoryPath = RepositoryPath Text
|
data RepositoryPath = RepositoryPath Text
|
||||||
deriving Show
|
deriving Show
|
||||||
|
@ -229,12 +230,12 @@ uniqueRemoteName r basename n
|
||||||
| n == 0 = basename
|
| n == 0 = basename
|
||||||
| otherwise = basename ++ show n
|
| otherwise = basename ++ show n
|
||||||
|
|
||||||
{- Start syncing a newly added remote. -}
|
{- Start syncing a newly added remote, using a background thread. -}
|
||||||
syncRemote :: Remote -> Handler ()
|
syncRemote :: Remote -> Handler ()
|
||||||
syncRemote remote = do
|
syncRemote remote = do
|
||||||
webapp <- getYesod
|
webapp <- getYesod
|
||||||
runAnnex () $ updateKnownRemotes (daemonStatus webapp)
|
runAnnex () $ updateKnownRemotes (daemonStatus webapp)
|
||||||
liftIO $ do
|
void $ liftIO $ forkIO $ do
|
||||||
reconnectRemotes "WebApp"
|
reconnectRemotes "WebApp"
|
||||||
(fromJust $ threadState webapp)
|
(fromJust $ threadState webapp)
|
||||||
(daemonStatus webapp)
|
(daemonStatus webapp)
|
||||||
|
|
Loading…
Reference in a new issue