Long Running Tasks - What Pattern?

Hi,

I have some tasks that a user initiates from a page. This task might run
longer than the browser timeout.

What is the best way to deal with this?

Thanks
Joerg

Have you looked into the daemons gem? It might possibly fit your need.

RSL

Thanks - that looks pretty wikkid.

So - what would be a good pattern then?
I post the request to run the task, on the server start the task in a
new thread, and tell the user that the task is being performed.

What would be a good practice to inform the user? Send an email? Have
some or other hook to display it on the site again once the task is
completed?

Looks promising so far, though.

Joerg

Shawn Roske wrote:

http://backgroundrb.rubyforge.org/

It depends on what kind of task you are planning on offloading. If it
is something the user needs to wait for, perhaps you could provide a
progress bar? Otherwise a system message or email when completed
should work. Again it depends on what this process is doing and
whether it “makes sense”.

-Shawn

http://backgroundrb.rubyforge.org/

Hey Shawn (and Russell and dysinger) thanks for your help so far. I
didn’t realize that I could use a progress bar for this kind of work.
Actually not really sure how they work - do they poll the server every
few seconds?
Can I use a progress bar with Mongrel? Are there plugins/AJAX widgets
for progress bars that would be recommended for long running tasks (in
conjunction with bDRb)?

Thanks so much!

Joerg

Shawn Roske wrote:

It depends on what kind of task you are planning on offloading. If it
is something the user needs to wait for, perhaps you could provide a
progress bar? Otherwise a system message or email when completed
should work. Again it depends on what this process is doing and
whether it “makes sense”.

-Shawn

Use DRb or Reliable Messaging to communicate with another back-ground
process.

On Mar 28, 5:21 am, Joerg D. [email protected]