rosa-build/app/jobs/build_lists/clear_stale_builders.rb

11 lines
335 B
Ruby
Raw Normal View History

2019-05-24 07:16:37 +01:00
module BuildLists
class ClearStaleBuilders < BaseActiveRecordJob
include Sidekiq::Worker
sidekiq_options :queue => :low
def perform_with_ar_connection
BuildList.where(["updated_at < ?", 900.seconds.ago]).where(status: BuildList::BUILD_PENDING).where.not(builder: nil).update_all(builder_id: nil)
end
end
end