I am running Rails 4.2.8 and I want to make my job only run under certain conditions. Currently I am doing that check in the code that is calling the job but it would be much cleaner to contain the logic in the job class. Has anyone done that?
class MyJob < ApplicationJob before_enqueue do |job| # check and stop job from being enqueued under certain conditions end def perform(args*) # code here endend
I am using Sidekiq 4.2.10 as the background job adapter.