assistant: When autostarted, wait 5 seconds before running the startup scan, to avoid contending with the user's desktop login process.

This commit is contained in:
Joey Hess 2013-10-26 12:42:58 -04:00
parent 4830c0d830
commit 2233ddd5a2
7 changed files with 61 additions and 32 deletions

View file

@ -48,6 +48,7 @@ import Assistant.Types.UrlRenderer
import qualified Utility.Daemon
import Utility.LogFile
import Utility.ThreadScheduler
import Utility.HumanTime
import qualified Build.SysConfig as SysConfig
import System.Log.Logger
@ -61,8 +62,8 @@ stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile
-
- startbrowser is passed the url and html shim file, as well as the original
- stdout and stderr descriptors. -}
startDaemon :: Bool -> Bool -> Maybe HostName -> Maybe (Maybe Handle -> Maybe Handle -> String -> FilePath -> IO ()) -> Annex ()
startDaemon assistant foreground listenhost startbrowser = do
startDaemon :: Bool -> Bool -> Maybe Duration -> Maybe HostName -> Maybe (Maybe Handle -> Maybe Handle -> String -> FilePath -> IO ()) -> Annex ()
startDaemon assistant foreground startdelay listenhost startbrowser = do
Annex.changeState $ \s -> s { Annex.daemon = True }
pidfile <- fromRepo gitAnnexPidFile
logfile <- fromRepo gitAnnexLogFile
@ -140,7 +141,7 @@ startDaemon assistant foreground listenhost startbrowser = do
, watch $ watchThread
-- must come last so that all threads that wait
-- on it have already started waiting
, watch $ sanityCheckerStartupThread
, watch $ sanityCheckerStartupThread startdelay
]
liftIO waitForTermination