Sha256: 907a26678cd820bb258d9d19a1d0aa4ec8738cc28a984f99d35f0be8bfd8422c
Contents?: true
Size: 1.16 KB
Versions: 126
Compression:
Stored size: 1.16 KB
Contents
require 'integration_helper' # Simple test of adding jobs to the current batch # Batches: # - Overall (TestWoker) + Another worker class AnotherWorker include Sidekiq::Worker def perform Sidekiq.logger.info "Another Worker" end end class TestWorker include Sidekiq::Worker def perform Sidekiq.logger.info "Test Worker" if bid batch.jobs do AnotherWorker.perform_async end end end end class MyCallback def on_success(status, options) Sidekiq.logger.info "Success #{options} #{status.data}" end alias_method :multi, :on_success def on_complete(status, options) Sidekiq.logger.info "Complete #{options} #{status.data}" end end batch = CanvasSync::JobBatches::Batch.new batch.description = 'Test batch' batch.callback_queue = :default batch.on(:success, 'MyCallback#on_success', to: 'success@gmail.com') batch.on(:success, 'MyCallback#multi', to: 'success@gmail.com') batch.on(:complete, MyCallback, to: 'complete@gmail.com') batch.jobs do 10.times do TestWorker.perform_async end end puts CanvasSync::JobBatches::Batch::Status.new(batch.bid).data dump_redis_keys Sidekiq::Worker.drain_all dump_redis_keys
Version data entries
126 entries across 126 versions & 1 rubygems