nesquena / backburner

Simple and reliable beanstalkd job queue for ruby
http://nesquena.github.com/backburner
MIT License
428 stars 68 forks source link

ActiveJob wait_until doesn't perform job :( #135

Closed activestylus closed 7 years ago

activestylus commented 7 years ago

perform_later works as expected, but if I try to add wait_until to the mix, the job is not executed at the specified time

PostStatusUpdateJob.set(wait_until: send_at).perform_later(post)

When this command is run, my backburner queue doesn't react at all. I see no movement in the logs. It's like the job was never requested.

This is what I'm working with:

class PostStatusUpdateJob < ApplicationJob
  queue_as :default

  def perform(post, user)
    post.update_column :sent_at, Time.now
    post.update_column :state, 'published'
    post.analytics.create_for(user)
  end

end

Am I missing something?

activestylus commented 7 years ago

Looks like I need to forget about ActiveJob and just use the core lib:

Biggest difference is that I must calculate the delay, but it's not hard:

seconds = send_at - Time.now
Backburner::Worker.enqueue(PostStatusUpdateJob, Post.first.id, delay: seconds)

That said, I will be filing a ticket with Rails core for this issue