2011-05-11 83 views
1

我正在使用从collectiveidea的delayed_job 2.1.4,它似乎执行方法永远不会被调用,即使作业处理并从队列中删除。我错过了什么吗?执行不被称为延迟作业

我用Rails 3.0.5在Heroku

在控制器:

Delayed::Job.enqueue FacebookJob.new 

在作业类:

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 

(整个代码:https://gist.github.com/966509

回答

0

简单的答案:DelayedJob知道认证和FBGraph :: User类吗?如果没有,你会看到你描述的行为:这些项目将被悄悄地从队列中移除。

  • 请参阅延迟作业Wiki中的this entry in the Delayed Job Wiki
  • 尝试在你的facebook_job.rb文件中添加'require authentication'和'require fb_graph'(或其他)。