开发者

perform not being called for Delayed Jobs

I'm using delayed_job 2.1.4 from collectiveidea, and it seems the perform method is never called even though the jobs are processed and removed from the queue. Am I missing something?

I'm using Rails 3.0.5 on Heroku

In the Controller:

Delayed开发者_运维知识库::Job.enqueue FacebookJob.new

In the Job class:

class FacebookJob
  def initialize
  end

  def perform
    fb_auths = Authentication.where(:provider => 'facebook')
    fb_auths.each do |auth|
      checkins = FbGraph::User.new('me', :access_token => URI.encode(auth.token)).checkins
      if checkins != nil 
        checkins.each do |checkin|
          [...]
        end
      end
    end
  end
end

(the whole code: https://gist.github.com/966509)


The simple answer: does DelayedJob know about the Authentication and FBGraph::User classes? If not, you'll see exactly the behavior you describe: the items will be silently removed from the queue.

  • See this entry in the Delayed Job Wiki in the Delayed Job Wiki.
  • Try adding 'require authentication' and 'require fb_graph' (or whatever) in your facebook_job.rb file.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜