You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this isn't an active project but we hit this bug on our production server and it took a while to pin down. To reproduce, create about 10 sensors, set all of them to events_count=0, load the page. The limit=5 will load 5 objects, but the view will then load another 5 objects since it's an unordered collection. I was able to work around this by forcing the sensor to an array before passing to the view.
I know this isn't an active project but we hit this bug on our production server and it took a while to pin down. To reproduce, create about 10 sensors, set all of them to events_count=0, load the page. The limit=5 will load 5 objects, but the view will then load another 5 objects since it's an unordered collection. I was able to work around this by forcing the sensor to an array before passing to the view.
https://github.com/Snorby/snorby/blob/master/app/controllers/page_controller.rb#L46
-@sensors = Sensor.all(:limit => 5, :order => [:events_count.desc])
+@sensors = Sensor.all(:limit => 5, :order => [:events_count.desc]).to_a # eagerly load the initial result set
The text was updated successfully, but these errors were encountered: