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.27 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.26 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.25 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.23 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.22 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.21 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.20 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.19 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.18 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.17 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.16 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.15 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.14 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.13 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.12 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.11 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.10 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.9 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.8 app/workers/workarea/verify_scheduled_releases.rb
workarea-core-3.5.7 app/workers/workarea/verify_scheduled_releases.rb