2011-05-11 81 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'(或其他)。