Refactor job event collection to build and manage an internal cache of

potential parent values to reduce the number of queries to the database
This commit is contained in:
Matthew Jones
2014-06-24 10:36:25 -04:00
parent c60fb7a58f
commit 41e1d809b5
3 changed files with 134 additions and 83 deletions

View File

@@ -675,7 +675,8 @@ class JobEvent(CreatedModifiedModel):
update_fields.append('host_id')
except (IndexError, AttributeError):
pass
self.parent = self._find_parent()
if self.parent is None:
self.parent = self._find_parent()
if 'parent' not in update_fields:
update_fields.append('parent')
super(JobEvent, self).save(*args, **kwargs)