On Wed, May 13, 2009 at 9:20 AM, Chris Johnson <[email protected]>wrote:

> Hi,
>
> As I understand from reading the list, when you queue a task to be
> executed, you need to issue some variation of the above command to mark the
> task as completed.
>
> Given that I am queuing the task from my rails app, and the task runs
> within my worker, I assume I need to mark the job as finished in the method
> of that same worker class that does the work. Could someone give me a better
> example of how (syntax-wise) to issue that command properly?
>
> For example, here's my worker:
>
>
> class ReportingWorker < BackgrounDRb::MetaWorker
>  set_worker_name :reporting_worker
>  set_no_auto_load false
>
>  def create(args=nil)
>    logger.info "ReportingWorker started."
>  end
>
>  def create_export(args)
>    work_order_id = args[0]
>    user_id = args[1]
>
>    # DO STUFF HERE
>    # FINISHED!
>
>    # HOW DO I MARK IT AS FINISHED IN THE QUEUE ?????
>    persistent_job.finish!
>
>  end # create_export
> end
>

why persistent_job will always refer to current job thats being executed
from the queue and hence calling finish! on it will mark the job as done.
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Reply via email to