when multiple pulses per second are received for a single sensor, rrdtool will reject the new series of measurements: minimum one second step. introduce a fix in the Flukso daemon

This commit is contained in:
Bart Van Der Meerssche 2010-04-19 23:53:07 +02:00
parent 25c49be892
commit 5f516e2fed
1 changed files with 3 additions and 1 deletions

View File

@ -79,12 +79,14 @@ function buffer(child, interval)
return coroutine.create(function(meter, timestamp, value)
local measurements = data.new()
local threshold = os.time() + interval
local old_timestamp = 0
while true do
if meter ~= nil and timestamp > 1234567890 then measurements:add(meter, timestamp, value) end
if meter ~= nil and timestamp > math.max(1234567890, old_timestamp) then measurements:add(meter, timestamp, value) end
if timestamp > threshold and next(measurements) then --checking whether table is not empty
coroutine.resume(child, measurements)
threshold = timestamp + interval
old_timestamp = timestamp
end
meter, timestamp, value = coroutine.yield()
end