refactor
This commit is contained in:
parent
39569e889a
commit
247099f628
1 changed files with 16 additions and 13 deletions
29
Assistant.hs
29
Assistant.hs
|
@ -87,21 +87,24 @@ startDaemon assistant foreground
|
||||||
pidfile <- fromRepo gitAnnexPidFile
|
pidfile <- fromRepo gitAnnexPidFile
|
||||||
go $ Utility.Daemon.daemonize logfd (Just pidfile) False
|
go $ Utility.Daemon.daemonize logfd (Just pidfile) False
|
||||||
where
|
where
|
||||||
go a = withThreadState $ \st -> do
|
go daemonize = withThreadState $ \st -> do
|
||||||
checkCanWatch
|
checkCanWatch
|
||||||
dstatus <- startDaemonStatus
|
dstatus <- startDaemonStatus
|
||||||
liftIO $ a $ do
|
liftIO $ daemonize $ run dstatus st
|
||||||
changechan <- newChangeChan
|
run dstatus st = do
|
||||||
commitchan <- newCommitChan
|
changechan <- newChangeChan
|
||||||
pushmap <- newFailedPushMap
|
commitchan <- newCommitChan
|
||||||
_ <- forkIO $ commitThread st changechan commitchan
|
pushmap <- newFailedPushMap
|
||||||
_ <- forkIO $ pushThread st commitchan pushmap
|
mapM_ (void . forkIO)
|
||||||
_ <- forkIO $ pushRetryThread st pushmap
|
[ commitThread st changechan commitchan
|
||||||
_ <- forkIO $ mergeThread st
|
, pushThread st commitchan pushmap
|
||||||
_ <- forkIO $ daemonStatusThread st dstatus
|
, pushRetryThread st pushmap
|
||||||
_ <- forkIO $ sanityCheckerThread st dstatus changechan
|
, mergeThread st
|
||||||
_ <- forkIO $ watchThread st dstatus changechan
|
, daemonStatusThread st dstatus
|
||||||
waitForTermination
|
, sanityCheckerThread st dstatus changechan
|
||||||
|
, watchThread st dstatus changechan
|
||||||
|
]
|
||||||
|
waitForTermination
|
||||||
|
|
||||||
stopDaemon :: Annex ()
|
stopDaemon :: Annex ()
|
||||||
stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile
|
stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile
|
||||||
|
|
Loading…
Reference in a new issue