app/models/foreman_tasks/lock.rb in foreman-tasks-0.6.12 vs app/models/foreman_tasks/lock.rb in foreman-tasks-0.6.13
- old
+ new
@@ -55,10 +55,11 @@
not colliding_locks.any?
end
# returns a scope of the locks colliding with this one
def colliding_locks
- colliding_locks_scope = Lock.active.where(Lock.arel_table[:task_id].not_eq(task_id))
+ task_ids = task.self_and_parents.map(&:id)
+ colliding_locks_scope = Lock.active.where(Lock.arel_table[:task_id].not_in(task_ids))
colliding_locks_scope = colliding_locks_scope.where(name: name,
resource_id: resource_id,
resource_type: resource_type)
unless self.exclusive?
colliding_locks_scope = colliding_locks_scope.where(:exclusive => true)