mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
0.2.5 initial commit
Makefile incomplete
This commit is contained in:
20
agent/src/Daemon/RefreshProcDev.hs
Normal file
20
agent/src/Daemon/RefreshProcDev.hs
Normal file
@@ -0,0 +1,20 @@
|
||||
module Daemon.RefreshProcDev where
|
||||
|
||||
import Startlude
|
||||
|
||||
import Data.IORef
|
||||
|
||||
import Foundation
|
||||
import Lib.Error
|
||||
import Lib.External.Metrics.ProcDev
|
||||
|
||||
refreshProcDev :: AgentCtx -> IO ()
|
||||
refreshProcDev agentCtx = do
|
||||
let procDevCache = appProcDevMomentCache agentCtx
|
||||
(oldTime, oldMoment, _) <- liftIO . readIORef . appProcDevMomentCache $ agentCtx
|
||||
|
||||
eProcDev <- runS9ErrT $ getProcDevMetrics (oldTime, oldMoment)
|
||||
case eProcDev of
|
||||
Left e -> putStrLn @Text . show $ e
|
||||
Right (newTime, newMoment, newMetrics) -> liftIO $ writeIORef procDevCache (newTime, newMoment, newMetrics)
|
||||
|
||||
Reference in New Issue
Block a user