Delayed job not entering into the main jobs queue while using Resque-scheduler and redis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Delayed job not entering into the main jobs queue while using Resque-scheduler and redis

Mahesh Mesta
I need to perform a job wherein each time an order is created it is assigned to a vendor and if the vendor does not accept the order and updates the status within a specified time, the order is auto-rejected and the status updated to rejected. The problem which I am facing is that the job goes to the delayed queue as shown in the resque web view but does not moves to the main queue after the specified time for it to delay lapses

Here is my job.

      class AutoRejectionJob < ActiveJob::Base
        queue_as :auto_rejection_queue

       def perform(*args) 
        assignment_id = args[0]
        order_assignment = Estamps::Assignment.find(assignment_id)
        if order_assignment.status_id == 1 || order_assignment.status_id == nil
          order_assignment.status_id = 3
          order_assignment.save!
        end
       end
      end         

In my assignment model: 
    class Estamps::Assignment < ActiveRecord::Base
     after_create :enqueue_check_status 
  
    def enqueue_check_status #  
      AutoRejectionJob.set(wait: 2.minutes).perform_later(self.id)
    end    
    end


Here once an assignment record is created the status is usually kept as "assigned" at time of its creation. Now from the time of its creation, if the user does not update the status within the specified time, the job has to automatically update the status to "rejected".

I tried this method too.

    def enqueue_check_status 
      Resque.enqueue_at_with_queue('auto_rejection_queue', 2.minutes.from_now, 
       AutoRejectionJob, assignment_id: self.id)  
    end
 
Both of them send the job to the resque delayed queue but do not or bring the job to the main queue to perform.

Also, the time stamp for the job shows no jobs listed to be scheduled when I click on the all schedules link for the delayed job.

I am stuck with this issue for almost two weeks. Please, help! If any more info is needed, let me know. Having a tough time with this one.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cbbe2ffe-b704-46ef-99f5-adc8404fc1f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Delayed job not entering into the main jobs queue while using Resque-scheduler and redis

Mike Simkins
I don't understand what you mean by 'bringing it back to the main queue'

You are explicitly putting it in a queue, but it sounds like you do not have a worker running to process that queue, if so the job will never execute

You need to have a worker running for each queue name, can you check that ??

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e49f4666-32a8-4e56-9b27-c6c522a1a0eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.