rosa-build/app/jobs/restart_nodes_job.rb

12 lines
330 B
Ruby
Raw Normal View History

2014-04-15 19:08:43 +01:00
class RestartNodesJob
2014-04-15 19:41:06 +01:00
@queue = :low
2014-04-15 19:08:43 +01:00
def self.perform
2014-04-17 20:08:22 +01:00
return if NodeInstruction.all_locked?
2014-04-17 21:18:24 +01:00
available_nodes = RpmBuildNode.all.map{ |n| n.user_id if n.user.try(:system?) }.compact.uniq
2014-04-15 19:08:43 +01:00
NodeInstruction.where(status: NodeInstruction::READY).
where.not(user_id: available_nodes).find_each(&:restart)
2014-04-15 19:08:43 +01:00
end
end