mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
sleep before looping
This commit is contained in:
@@ -19,6 +19,7 @@ module Application
|
|||||||
, handler
|
, handler
|
||||||
, runDb
|
, runDb
|
||||||
, getAgentCtx
|
, getAgentCtx
|
||||||
|
, sleep
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
@@ -189,7 +190,7 @@ startupSequence foundation = do
|
|||||||
withAgentVersionLog_ "App notifications refreshing"
|
withAgentVersionLog_ "App notifications refreshing"
|
||||||
|
|
||||||
withAgentVersionLog_ "Initializing SSL certificate renewal loop"
|
withAgentVersionLog_ "Initializing SSL certificate renewal loop"
|
||||||
void . forkIO . forever $ forkIO $ SSLRenew.renewSslLeafCert foundation
|
void . forkIO . forever $ forkIO $ SSLRenew.renewSslLeafCert foundation *> sleep 86_400
|
||||||
withAgentVersionLog_ "SSL Renewal daemon started"
|
withAgentVersionLog_ "SSL Renewal daemon started"
|
||||||
|
|
||||||
-- reloading avahi daemon
|
-- reloading avahi daemon
|
||||||
@@ -204,6 +205,10 @@ startupSequence foundation = do
|
|||||||
withAgentVersionLog_ "Listening for Self-Update Signal"
|
withAgentVersionLog_ "Listening for Self-Update Signal"
|
||||||
waitForUpdateSignal foundation
|
waitForUpdateSignal foundation
|
||||||
|
|
||||||
|
sleep :: Integer -> IO ()
|
||||||
|
sleep n = let (full, r) = (n * 1_000_000) `divMod` (fromIntegral $ (maxBound :: Int)) in
|
||||||
|
replicateM_ (fromIntegral full) (threadDelay maxBound) *> threadDelay (fromIntegral r)
|
||||||
|
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
-- Functions for DevelMain.hs (a way to run the AgentCtx from GHCi)
|
-- Functions for DevelMain.hs (a way to run the AgentCtx from GHCi)
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user