Bug #27332
closedList all hosts page in an organization takes long time when there is a lot of reports
Description
Description of problem:
Satellite is taking long time to load the All Host page in an organization when there is a lot of reports.
There is a default scope in "app/models/foreman_openscap/arf_report.rb"
default_scope do
with_taxonomy_scope do
order("#{self.table_name}.created_at DESC")
end
end
With "Organization.current" set, the above function will try to filter the reports by organization. This seems to cause ruby to take long time to construct a list of report ids in an organization to be filtered when there is a lot of reports in an organization.
Version-Release number of selected component (if applicable):
6.5
Steps to Reproduce:
1. Need to have many content hosts that run openscap scan and upload the reports to the Satellite.
2. Make sure "Any organization" is set
3. Go to Hosts -> All Hosts page
4. The page should finish loading within an acceptable time.
5. Now, set the organization.
6. Refresh the "All Hosts" page again
7. The page will take several minutes to load.
Actual results:
"All hosts" page takes long time to load
Expected results:
"All hosts" page should finish loading within an acceptable time.