Class: SidekiqPublisher::Publisher
- Inherits:
-
Object
- Object
- SidekiqPublisher::Publisher
- Defined in:
- lib/sidekiq_publisher/publisher.rb
Instance Method Summary collapse
-
#initialize ⇒ Publisher
constructor
A new instance of Publisher.
- #publish ⇒ Object
Constructor Details
#initialize ⇒ Publisher
Returns a new instance of Publisher.
8 9 10 11 |
# File 'lib/sidekiq_publisher/publisher.rb', line 8 def initialize @client = SidekiqPublisher::Client.new @job_class_cache = {} end |
Instance Method Details
#publish ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sidekiq_publisher/publisher.rb', line 13 def publish Job.unpublished_batches do |batch| items = batch.map do |job| { "jid" => job[:job_id], "class" => lookup_job_class(job[:job_class]), "args" => job[:args], "at" => job[:run_at], "queue" => job[:queue], "wrapped" => job[:wrapped], "created_at" => job[:created_at].to_f, }.tap(&:compact!) end publish_batch(batch, items) end purge_expired_published_jobs rescue StandardError => ex failure_warning(__method__, ex) end |