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

Rails set(wait: 2.minutes) method for active job does not works

$
0
0

Creating an background job with the resque_scheduler gem on Redis server.

 class Estamps::OrderAssignment < ActiveRecord::Base  after_save :enqueue_check_status   def enqueue_check_status        AutoRejectionJob.set(wait: 2.minutes).perform_later(self.id)   end end class AutoRejectionJob < ActiveJob::Base   queue_as :default   def perform(*args)     order_assignment_id = args[0]    order_assignment = Estamps::OrderAssignment.find(order_assignment_id)    if order_assignment.status_id == 1 || order_assignment.status_id == nil      order_assignment.status_id = 3      order_assignment.save!    end  end end         

On creation of OrderAssignment record or when updated after 2 minutes it should run AutoRejection Job. Here the prob is the set(wait: 2.minutes) does not seem to run, i.e.

   AutoRejectionJob.perform_later(self.id)

works perfectly fine, but

  AutoRejectionJob.set(wait: 2.minutes).perform_later(self.id)

does nothing. Haven't been able to rectify the issue. Newbie to Rails so please help.


Viewing all articles
Browse latest Browse all 873

Trending Articles



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