The last seen devices in the live view are currently populated by traversing all devices and adding those which are in the different time periods (last 5 min, last hour, last day):
This is very inefficient and doesn't scale, since we query all 65k (current) devices and send them to the browser. We should query once with something like:
to query all devices in the last hour (also with a sensible upper limit of ~1000), and then traverse those and add them to the corresponding bucket. Or alternatively make three different queries for each bucket (might be less efficient) No need to get all 65k devices. :smirk:
The last seen devices in the live view are currently populated by traversing all devices and adding those which are in the different time periods (last 5 min, last hour, last day):
See live.controller.js
This is very inefficient and doesn't scale, since we query all 65k (current) devices and send them to the browser. We should query once with something like:
to query all devices in the last hour (also with a sensible upper limit of ~1000), and then traverse those and add them to the corresponding bucket. Or alternatively make three different queries for each bucket (might be less efficient) No need to get all 65k devices. :smirk: