On Feb 18, 2008 8:45 AM, hemant <[EMAIL PROTECTED]> wrote:

> On Sun, Feb 17, 2008 at 11:08 PM, John Wells
> <[EMAIL PROTECTED]> wrote:
> > Guys,
> >
> > Is there any sort of mechanism for canceling workers? I've looked
> through
> > the docs and don't see any but may be overlooking.
> >
>
> What you mean by canceling the job? You mean the one scheduled or one
> from queue?


Well, when I sent this, it was to cancel a job that was started on an
autostarted worker with ask_work. However, I've since changed the worker to
not autostart. I then do call:

# controller action to start
def start_work
  MiddleMan.new_worker(:worker=>"my_worker")
  MiddleMan.ask_work(:worker=>"my_worker", :worker_method=>"my_method")
end

# controller action to stop
def stop_work
  MiddleMan.delete_worker(:worker=>"my_worker")
end

This seems to work, but there are a few undesired things left dangling, as I
haven't found a way to "catch" the delete request and do a cleanup. Assuming
this is impossible, is there any way to clear the last status registered by
the worker with register_status if that worker is deleted?

And, is the above the proper way of cancelling work?

Thanks very much for your help!

John

<http://www.greatworx.com>
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Reply via email to