ruby on rails - Delayed Job just not working -


i building application @ point need sync bunch of data fb database, (attemtping) use delayed job push background. here part of delayed job class looks like.

class fbsyncjob < struct.new(:user_id)   require 'rsvphelper'    def perform     user = user.find(user_id)     fbsyncjob.sync_user(user)   end    def fbsyncjob.sync_user(user)     friends = httparty.get(       "https://graph.facebook.com/me/friends?access_token=#{user.fb['token']}"     )     friends_list = friends["data"].map { |friend| friend["id"] }     user.fb["friends"] = friends_list     user.fb["sync"]["friends"] = time.now     user.save!     fbsyncjob.friend_crawl(user)   end end 

with rsvphelper class living in lib/rsvphelper.rb. @ point in application call delayed::job.enqueue(fbsyncjob.new(user.id)) known valid user. worker set tells me job has been completed successfully:

1 jobs processed @ 37.1777 j/s, 0 failed

however when check user in database has not had friends list updated. doing wrong or what? has been driving me crazy.

delayed::job.enqueue put record in delayed job table, need run seperate process execute job code (perform method)

typically in development bundle exec rake jobs:work (note: must restart rake task anytime make code changes, not auto load changes)

i put following delayed configuration while in development - never puts record in delayed job table , runs background code synchronously (in development) , default rails reload changes code

delayed::worker.delay_jobs = !(rails.env.test? || rails.env.development?)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -