mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 21:37:42 -02:30
Merge pull request #4137 from chrismeyersfsu/fix-smart_inv_race
wrap smart inv cache update w/ advisory lock Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -602,6 +602,7 @@ def update_inventory_computed_fields(inventory_id, should_update_hosts=True):
|
|||||||
|
|
||||||
|
|
||||||
def update_smart_memberships_for_inventory(smart_inventory):
|
def update_smart_memberships_for_inventory(smart_inventory):
|
||||||
|
with advisory_lock('update_smart_memberships_for_inventory-{}'.format(smart_inventory.id)):
|
||||||
current = set(SmartInventoryMembership.objects.filter(inventory=smart_inventory).values_list('host_id', flat=True))
|
current = set(SmartInventoryMembership.objects.filter(inventory=smart_inventory).values_list('host_id', flat=True))
|
||||||
new = set(smart_inventory.hosts.values_list('id', flat=True))
|
new = set(smart_inventory.hosts.values_list('id', flat=True))
|
||||||
additions = new - current
|
additions = new - current
|
||||||
|
|||||||
Reference in New Issue
Block a user