Guest User

Untitled

a guest
Feb 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. while true do
  2. opts[:offset] = offset
  3. offset += opts[:limit]
  4. found = DnsCountTelemetry.find_restricted(:all,opts)
  5. break if (found.nil? or found.size < 1)
  6. @records += found.size
  7. found.each { |dct|
  8. (0..COLUMNS.size-1).each { |c|
  9. cur = dct[COLUMNS[c].keys[0]]
  10. next unless cur != pre[c]
  11. num = cur < pre[c] ? cur : cur - pre[c]
  12. pre[c] = cur
  13. month = dct.created_at.month.to_i
  14. wday = dct.created_at.wday.to_i
  15. hour = dct.created_at.hour.to_i
  16. @counts[:month][month][c] += num
  17. @counts[:wday][wday][c] += num
  18. @counts[:hour][hour][c] += num
  19. @counts[:column][c] += num
  20. @counts[:detail][month][wday][hour][c] += num
  21. }
  22. }
  23. end
  24. GC.start
Add Comment
Please, Sign In to add comment