On Feb 2, 2008 10:27 PM, hemant <[EMAIL PROTECTED]> wrote:
>
> Yes it should be pretty simple to have an implementation like this:
>
> # don't execute the task now, but delay it by half an hour
> def test_method(args = nil)
>   add_timer(30*60) { run_actual_method(args) }
> end
>
> def run_actual_method args
>   # execute the delayed task
> end
>

Also, if you need to set that time dynamically from rails, then you
can pass time as an argument to test_method,

MiddleMan.ask_work(:worker => :foo_worker,:worker_method =>
:test_method, :data => { :firetime => 60,:args => "bar"})

and in test_method

def test_method args
  add_timer(args[:firetime]) { fire_method(args[:args]) }
end
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Reply via email to