When forgetting data from the buffer because the maximal buffer size is reached, forget the oldest value, not the newest one.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/DataCollectors/CPUload.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Ganeti/DataCollectors/CPUload.hs b/src/Ganeti/DataCollectors/CPUload.hs index 65ac423..ed13bde 100644 --- a/src/Ganeti/DataCollectors/CPUload.hs +++ b/src/Ganeti/DataCollectors/CPUload.hs @@ -149,10 +149,7 @@ formatData l@(x:xs) = CPUavgload (length l - 1) xs x -- | Update a Map Entry. updateEntry :: Buffer -> Buffer -> Buffer updateEntry newBuffer mapEntry = - (Seq.><) newBuffer - (if Seq.length mapEntry < bufferSize - then mapEntry - else Seq.drop 1 mapEntry) + (Seq.><) newBuffer (Seq.take bufferSize mapEntry) -- | Updates the given Collector data. dcUpdate :: Maybe CollectorData -> IO CollectorData -- 2.7.0.rc3.207.g0ac5344
