mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
Merge pull request #612 from ryanpetrello/release_3.2.2
fix a race condition in "host.last_job" when jobs are deleted
This commit is contained in:
@@ -296,7 +296,12 @@ def _update_host_last_jhs(host):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
jhs = None
|
jhs = None
|
||||||
update_fields = []
|
update_fields = []
|
||||||
last_job = jhs.job if jhs else None
|
try:
|
||||||
|
last_job = jhs.job if jhs else None
|
||||||
|
except Job.DoesNotExist:
|
||||||
|
# The job (and its summaries) have already been/are currently being
|
||||||
|
# deleted, so there's no need to update the host w/ a reference to it
|
||||||
|
return
|
||||||
if host.last_job != last_job:
|
if host.last_job != last_job:
|
||||||
host.last_job = last_job
|
host.last_job = last_job
|
||||||
update_fields.append('last_job')
|
update_fields.append('last_job')
|
||||||
|
|||||||
Reference in New Issue
Block a user