On 2/22/06, Jake <vanguardian@netscape.net> wrote:> Got another question. It''s unclear to me what "every"
means in the background
> function and how it relates to the RailsCron.create "every":
>
> >From README:
>
> RailsCron.create(
> :command => "Object.do_something()",
> :start => 2.minutes.from_now,
> :every => 12.hours, # default: 1.day
> :finish => 2.years.from_now # optional
> )
>
> class EmailQueue < ActiveRecord::Base
> background :deliver, :every => 1.minute, :concurrent => true
>
> def self.deliver
> #process the queue
> end
> end
>
> It seems to me that the create method creates a job that runs every 12
hours.
> If the command were "EmailQueue.deliver", I''d assume
that the "deliver" method
> would run every 12 hours.
>
> Then it confuses me that there''s another every in the EmailQueue
background
> call. What exactly does background do? And how does this
"every" interact with
> RailsCron "every"?
>
> Thanks,
> Jake
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
Those code samples are different ways of doing the same thing. A or
B, not A and B. This difference is that background manages itself
through RailsCron.create_singleton, so that it autodetects changes to
your code.
--
Kyle Maxwell
Chief Technologist
E Factor Media // FN Interactive
kyle@efactormedia.com
1-866-263-3261