Sha256: 1d4f942adbf176f64c8b7584a7eea9f333ff1d305dd9da0d27443c8853220565

Contents?: true

Size: 597 Bytes

Versions: 6

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.1.0
module Sidekiq::Portal::CoreExtensions::SidekiqWorker
  # @return [void]
  #
  # @api public
  # @since 0.1.0
  def run_scheduled
    timezone = Sidekiq::Portal.config[:default_timezone]
    timezoner = ActiveSupport::TimeZone[timezone]
    current_time = timezoner.at(Time.current)

    jobs.each do |job|
      next if job.key?('at') && timezoner.at(job['at']) > current_time

      Sidekiq::Queues.delete_for(job['jid'], job['queue'], job['class'])
      Sidekiq::Testing.constantize(job['class']).process_job(job)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sidekiq_portal-0.3.2 lib/portal/core_extensions/sidekiq_worker.rb
sidekiq_portal-0.3.1 lib/portal/core_extensions/sidekiq_worker.rb
sidekiq_portal-0.3.0 lib/portal/core_extensions/sidekiq_worker.rb
sidekiq_portal-0.2.0 lib/portal/core_extensions/sidekiq_worker.rb
sidekiq_portal-0.1.1 lib/portal/core_extensions/sidekiq_worker.rb
sidekiq_portal-0.1.0 lib/portal/core_extensions/sidekiq_worker.rb