Bug #26260
closeddb:seed on Foreman 1.21 takes too long if you have a lot of discovered hosts
Description
Hi,
I have a Foreman instance with about 17k hosts and 18k discovered hosts and db:seed is taking a lot of time to assign the resources to the new default organization that 1.21 creates:
[root@devforeman ~]# grep organization_id /var/log/foreman/production.log | head -1
2019-03-06T16:23:56 [I|aud|] Host::Base (293112) update event on organization_id , 117
[root@devforeman ~]# grep organization_id /var/log/foreman/production.log | tail -1
2019-03-06T19:08:31 [I|aud|] Host::Base (194789) update event on organization_id , 117
[root@devforeman ~]# grep -c update /var/log/foreman/production.log
2942
Every update is taking about 3-4 seconds:
2019-03-06T19:04:22 [I|aud|] Host::Base (195408) update event on organization_id , 117
2019-03-06T19:04:27 [I|aud|] Host::Base (195407) update event on organization_id , 117
2019-03-06T19:04:31 [I|aud|] Host::Base (195406) update event on organization_id , 117
2019-03-06T19:04:35 [I|aud|] Host::Base (195405) update event on organization_id , 117
2019-03-06T19:04:39 [I|aud|] Host::Base (195404) update event on organization_id , 117
Shouldn't this be faster?
Thank you.