Sha256: 49f6d44c71b3c3480a3a87779e5ec3ef47e0b7f8ed4dcb3469bd36cad6243839
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
require 'active_support/concern' class Job module Cleanup extend ActiveSupport::Concern FORCE_FINISH_MESSAGE = <<-msg.strip This job could not be processed and was forcefully finished. msg included do class << self def cleanup unfinished.stalled.each do |job| job.requeueable? ? job.enqueue : job.force_finish end end def unfinished where("state <> 'finished'") end def stalled where('created_at < ?', Time.now - Travis.config.jobs.retry.after) end end end def enqueue Travis::Notifications::Worker.enqueue(self) update_attribute(:retries, retries + 1) end def force_finish append_log!("\n#{FORCE_FINISH_MESSAGE}") if respond_to?(:append_log!) finish!(:status => 1, :finished_at => Time.now) end def requeueable? false # retries < Travis.config.jobs.retry.max_attempts end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
travis-core-0.0.1 | lib/travis/model/job/cleanup.rb |