Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- opts[:offset] = offset
- offset += opts[:limit]
- found = DnsCountTelemetry.find_restricted(:all,opts)
- break if (found.nil? or found.size < 1)
- @records += found.size
- found.each { |dct|
- (0..COLUMNS.size-1).each { |c|
- cur = dct[COLUMNS[c].keys[0]]
- next unless cur != pre[c]
- num = cur < pre[c] ? cur : cur - pre[c]
- pre[c] = cur
- month = dct.created_at.month.to_i
- wday = dct.created_at.wday.to_i
- hour = dct.created_at.hour.to_i
- @counts[:month][month][c] += num
- @counts[:wday][wday][c] += num
- @counts[:hour][hour][c] += num
- @counts[:column][c] += num
- @counts[:detail][month][wday][hour][c] += num
- }
- }
- end
- GC.start
Add Comment
Please, Sign In to add comment