Commit d89cb844 authored by Klaus Aehlig's avatar Klaus Aehlig

MonD: force computation of state in stateful collectors

...to avoid stateful collectors that are not queried regularly
accumulating thunks.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 60e7b76e
......@@ -41,6 +41,8 @@ module Ganeti.Monitoring.Server
) where
import Control.Applicative
import Control.DeepSeq (force)
import Control.Exception.Base (evaluate)
import Control.Monad
import Control.Monad.IO.Class
import Data.ByteString.Char8 hiding (map, filter, find)
......@@ -251,6 +253,7 @@ collect m collector =
let name = dName collector
existing = Map.lookup name m
new_data <- update existing
_ <- evaluate $ force new_data
return $ Map.insert name new_data m
-- | Invokes collect for each data collector.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment