Forcing FCGI headers

T

Tony Targonski

In my Rails application, I have this one function that reads a list of
webpages and parses their contents. It takes about a minutes to
complete.

My FastCGI times out at 30 seconds and stops the application
[error] [client 10.4.114.211] FastCGI: comm with (dynamic) server
"C:/crawler/public/dispatch.fcgi" aborted: (first read) idle timeout (30
sec), referer: http://tor105850/trackers/

Though the function goes on to finish updating the database.

So my question is -- how would I set up my Rails controller to function
in the following manner

Render 'updating, please wait'
Function()
Render 'done'

Without having FastCGI time out on me?

Thank you,
--Tony
 
D

David Heinemeier Hansson

Without having FastCGI time out on me?

Basically, there's no way to do this that I know of. What you can do,
though, is to simply increase the FastCGI timeout. The default is a
meager 30 seconds. Way too low for a bunch of applications, including
Basecamp. We use 600 seconds (to allow for file uploads which are
shuttled on to the users on FTP server).

Alternatively, you can have your action trigger an external service of
some sorts that complete the computation asynchronously. Then you could
have some other way of alerting the users, like using Ajax (and
specifically periodically_call_remote which is in beta gems/SVN) to
check the status of the operation and report success when its done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,157
Messages
2,570,879
Members
47,414
Latest member
djangoframe

Latest Threads

Top