Ansible Tower inventory integration is slow
Description of problem:
When using the Ansible Tower built-in Satellite 6 inventory integration, a sync takes roughly 4 and a half hours to complete against 845 hosts. This behavior is identical from the command line using a straight invocation of foreman.py and matching the max_age parameter to what is already set in Tower.
Reproducible every time for this customer, but not reproducible for us locally.
Steps to Reproduce:
1. Pull down foreman.py and foreman.ini from https://github.com/ansible/ansible/tree/devel/contrib/inventory directory
2. Populate [foreman] section of foreman.ini with Sat host details.
3. Ensure max_age is set to 60
4. Run time ./foreman.py
Tower run: 14829.828 aka 247 minutes
Our local tests against half as many hosts were completing in 6 minutes so conservatively 20 minutes for this customer.