Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Rails ActiveJob - how to stop job from being enqueued in before_enqueue

$
0
0

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.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>