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:
parent
4830c0d830
commit
2233ddd5a2
7 changed files with 61 additions and 32 deletions
|
@ -25,15 +25,22 @@ import Utility.NotificationBroadcaster
|
|||
import Config
|
||||
import qualified Git
|
||||
import qualified Utility.Lsof as Lsof
|
||||
import Utility.HumanTime
|
||||
|
||||
import Data.Time.Clock.POSIX
|
||||
|
||||
{- This thread runs once at startup, and most other threads wait for it
|
||||
- to finish. (However, the webapp thread does not, to prevent the UI
|
||||
- being nonresponsive.) -}
|
||||
sanityCheckerStartupThread :: NamedThread
|
||||
sanityCheckerStartupThread = namedThreadUnchecked "SanityCheckerStartup" $
|
||||
startupCheck
|
||||
sanityCheckerStartupThread :: Maybe Duration -> NamedThread
|
||||
sanityCheckerStartupThread startupdelay = namedThreadUnchecked "SanityCheckerStartup" $ do
|
||||
checkStaleGitLocks
|
||||
|
||||
liftIO $ maybe noop (threadDelaySeconds . Seconds . fromIntegral . durationSeconds) startupdelay
|
||||
|
||||
{- Notify other threads that the startup sanity check is done. -}
|
||||
status <- getDaemonStatus
|
||||
liftIO $ sendNotification $ startupSanityCheckNotifier status
|
||||
|
||||
{- This thread wakes up hourly for inxepensive frequent sanity checks. -}
|
||||
sanityCheckerHourlyThread :: NamedThread
|
||||
|
@ -80,14 +87,6 @@ waitForNextCheck = do
|
|||
oneDay - truncate (now - lastcheck)
|
||||
| otherwise = oneDay
|
||||
|
||||
startupCheck :: Assistant ()
|
||||
startupCheck = do
|
||||
checkStaleGitLocks
|
||||
|
||||
{- Notify other threads that the startup sanity check is done. -}
|
||||
status <- getDaemonStatus
|
||||
liftIO $ sendNotification $ startupSanityCheckNotifier status
|
||||
|
||||
{- It's important to stay out of the Annex monad as much as possible while
|
||||
- running potentially expensive parts of this check, since remaining in it
|
||||
- will block the watcher. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue