You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class SimpleJob
include Sidekiq::Job
def perform(some_argument)
logger.info "Performing SimpleJob with argument: #{some_argument}"
# Simulate some work
sleep 2
logger.info "Completed SimpleJob with argument: #{some_argument}"
end
end
class SomeFinalJob
include Sidekiq::Job
def perform(status, options)
logger.info "All jobs in the batch have completed. Status: #{status}"
end
end
rails console
batch = Sidekiq::Batch.new
batch.description = "Test batch for SimpleJob"
batch.on(:complete, SomeFinalJob, {})
batch.jobs do
SimpleJob.perform_async("Test Argument 1")
SimpleJob.perform_async("Test Argument 2")
end
puts "Batch created with ID #{batch.bid}"
The text was updated successfully, but these errors were encountered:
Versions
sidekiq (7.3.0)
sidekiq-batch (0.2.0)
rails console
The text was updated successfully, but these errors were encountered: