Forum: Ruby BackgrounDRb behavoir

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sy Y. (Guest)
on 2007-05-27 03:58
Call me confused. I call the following:

MiddleMan.schedule_worker(
    :class => :update_friends_worker,
    :job_key => :schedule_test,
    :worker_method => :arg_method,
    :worker_method_args => "my argument to arg_method",
        :trigger_type => :cron_trigger,
        :trigger_args => "1 * * * * * *"
)

And that worker looks like:

class UpdateFriendsWorker < BackgrounDRb::Worker::RailsBase

  def do_work(args)
        logger.info('Shoes')
  end

end
UpdateFriendsWorker.register

Shouldn't the above put an entry 'Shoes' in the log every minute? I only
get 1, and that's it. Been waiting 5 minutes.

-Steve
Ezra Z. (Guest)
on 2007-05-27 04:22
(Received via mailing list)
On May 26, 2007, at 4:59 PM, Sy Ys wrote:

> Call me confused. I call the following:
>
> MiddleMan.schedule_worker(
>     :class => :update_friends_worker,
>     :job_key => :schedule_test,
>     :worker_method => :arg_method,

                                           ^^^^^^^^^^

The method that will be called by the scheduler is :arg_method since
thats how you defined it. The do_work method always gets called once
on worker instantiation. the :worker_method is the method that will
be called by the scheduler.

>         logger.info('Shoes')
>   end

     def arg_method
         logger.info('UrMom')
     end

> end
> UpdateFriendsWorker.register
>
> Shouldn't the above put an entry 'Shoes' in the log every minute? I
> only
> get 1, and that's it. Been waiting 5 minutes.
>
> -Steve


Cheers-
-- Ezra Z.
-- Lead Rails Evangelist
-- removed_email_address@domain.invalid
-- Engine Y., Serious Rails Hosting
-- (866) 518-YARD (9273)
Sy Y. (Guest)
on 2007-05-27 17:51
Doh. Simple mistake.

One more question. What is the preferred method for granting workers in
/lib/workers access to my application's controller classes?

Ezra Z. wrote:
> The method that will be called by the scheduler is :arg_method since
> thats how you defined it. The do_work method always gets called once
> on worker instantiation. the :worker_method is the method that will
> be called by the scheduler.
This topic is locked and can not be replied to.