Sha256: b6342f36959c5b66d137c35f80663b12499145984821babdb430dc2b1dab9248

Contents?: true

Size: 840 Bytes

Versions: 28

Compression:

Stored size: 840 Bytes

Contents

module Workarea
  # Verify that jobs for publishing releases do not get removed
  # unintentionally from Sidekiq and prevent the release from updating at the
  # expected time. If any are found missing, add a new job.
  # Runs hourly by default, 5 minutes before each hour.
  #
  class VerifyScheduledReleases
    include Sidekiq::Worker
    sidekiq_options queue: 'releases'

    def perform(*)
      # PublishRelease uses the default queue,
      # so only look there for scheduled release jobs
      job_ids = Sidekiq::Queue.new.map { |job| job.jid }
      now = Time.current

      Release.all.each do |release|
        if release.scheduled? &&
           release.publish_at > now &&
           !job_ids.include?(release.publish_job_id)

          release.set_publish_job
          release.save!
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.6 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.5 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.4 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.3 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.2 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.1 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.0 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.0.beta.1 app/workers/workarea/verify_scheduled_releases.rb