tweak
This commit is contained in:
parent
24da48816d
commit
7575c5bb56
1 changed files with 6 additions and 3 deletions
|
@ -51,14 +51,14 @@ daemonStatusThread :: ThreadState -> DaemonStatusHandle -> IO ()
|
||||||
daemonStatusThread st handle = do
|
daemonStatusThread st handle = do
|
||||||
checkpoint
|
checkpoint
|
||||||
forever $ do
|
forever $ do
|
||||||
threadDelay tenMinutes
|
threadDelay (tenMinutes * oneSecond)
|
||||||
checkpoint
|
checkpoint
|
||||||
where
|
where
|
||||||
checkpoint = runThreadState st $ do
|
checkpoint = runThreadState st $ do
|
||||||
file <- fromRepo gitAnnexDaemonStatusFile
|
file <- fromRepo gitAnnexDaemonStatusFile
|
||||||
status <- getDaemonStatus handle
|
status <- getDaemonStatus handle
|
||||||
liftIO $ writeDaemonStatusFile file status
|
liftIO $ writeDaemonStatusFile file status
|
||||||
tenMinutes = 10 * 60 * 1000000 -- microseconds
|
oneSecond = 1000000 -- microseconds
|
||||||
|
|
||||||
{- Don't just dump out the structure, because it will change over time,
|
{- Don't just dump out the structure, because it will change over time,
|
||||||
- and parts of it are not relevant. -}
|
- and parts of it are not relevant. -}
|
||||||
|
@ -100,4 +100,7 @@ afterLastDaemonRun :: EpochTime -> DaemonStatus -> Bool
|
||||||
afterLastDaemonRun timestamp status = maybe False (< t) (lastRunning status)
|
afterLastDaemonRun timestamp status = maybe False (< t) (lastRunning status)
|
||||||
where
|
where
|
||||||
t = realToFrac (timestamp + slop) :: POSIXTime
|
t = realToFrac (timestamp + slop) :: POSIXTime
|
||||||
slop = 10 * 60
|
slop = fromIntegral tenMinutes
|
||||||
|
|
||||||
|
tenMinutes :: Int
|
||||||
|
tenMinutes = 10 * 60
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue