why doesn't my delayed job work more than once when being triggered from a rails server? -


given delayed job worker,

class usercommentslistworker   attr_accessor :opts   def initialize opts = {}     @opts = opts   end    def perform     usercommentslist.new(@opts)   end    def before job     p 'before hook', job    end    def after job     p 'after hook', job   end    def success job     p 'success hook', job   end    def error job, exception     p '4', exception   end    def failure job     p '5', job   end    def enqueue job     p '-1', job   end  end 

when run delayed::job.enqueue usercommentslistworker.new(client: client) rails console, can repeated sequences of print statements , proper delayed job lifecyle hooks print including feedback worker job success.

including same call run worker via standard rails controller endpoint like;

include octohelper include queryhelper include objhelper include structuralhelper  class commentscontroller < applicationcontroller   before_filter :authenticate_user!    def index     if params['updatecache'] == 'true'       client = build_octoclient current_user.octo_token       delayed::job.enqueue usercommentslistworker.new(client: client)     end   end end 

i'm noticing worker run , created delayed job, none of hooks called , worker nevers logs job completed.

notice screenshot, enter image description here

jobs 73,75,76 triggered via roundtrip above referenced endpoint while job 74 triggered via rails console, wrong setup and/or failing notice in process? stress first time webserver hits above controller endpoint, job queues , runs subsequent instances job should run appear doing nothing , giving me no feedback in process.

i highlight i'm never seeing failure, error or enqueue hooks run.

thanks :)

the long , short of answer problem if notice, attempting store client object in delayed job notification causing problems, therefore, don't store complex objects in job, work basic data ids 1 or strings foo or booleans true etc. capisce?


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -