mirror of
https://github.com/ansible/awx.git
synced 2026-01-31 17:18:59 -03:30
Fix the cleanup_jobs management command
It previously depended on a private Django internal class that changed with Django 3.1. I've switched here instead to disabling the django-polymorphic accessors to get the underlying UnifiedJob object for a Job, which due to the way they implement those was resulting in N+1 behavior on deletes. This gets us back most of the way to the performance gains we achieved with the custom collector class. See https://github.com/django-polymorphic/django-polymorphic/issues/198.
This commit is contained in:
@@ -318,8 +318,9 @@ if __name__ == '__main__':
|
||||
for j_hour in range(24):
|
||||
time_delta = datetime.timedelta(days=i_day, hours=j_hour, seconds=0)
|
||||
created_job_ids = generate_jobs(jobs, batch_size=batch_size, time_delta=time_delta)
|
||||
for k_id in created_job_ids:
|
||||
generate_events(events, str(k_id), time_delta)
|
||||
if events > 0:
|
||||
for k_id in created_job_ids:
|
||||
generate_events(events, str(k_id), time_delta)
|
||||
print(datetime.datetime.utcnow().isoformat())
|
||||
conn.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user