Stack overflow in determining the pitch of a cucumber when re-setting a delayed job in .perform

I have a job that should re-queue:

class TestJob
  def perform
    Delayed::Job.enqueue(TestJob.new, {priority: 0, run_at: 5.minutes.from_now}) 
    true
  end
end

I would like to name his method performin the Cucumber step definition:

Then /^the job should run successfully/ do
  TestJob.new.perform.should == true
end

However, at this point I get a stack overflow. What causes this?

+3
source share
1 answer

I am sure that there is a β€œbest” answer, but the last time I tried to use the enqueue method, it was β€œbroken”. By this, I mean that I could not get it to work.

I do something similar to what you do, besides what I do

TestJob.new.delay(:run_at => 10.seconds.from_now).perform
0
source

All Articles