views:

29

answers:

1

Hi

My Controller waits for a response from a lib folder ruby file which it is calling.

lib.rb runs for about 4 minutes and returns a string as result.

The controller waits for the string response and then application breaks after a minute showing Internal Server Error

what should i Do?

Regards

A: 

Can you describe in more detail what this "lib" is doing? If it is intended to take a long time you will have to adjust your server settings so it is not prematurely timed out.

For example, Apache will produce a server error if it does not receive a response from your application in a timely manner. This time can be adjusted within certain parameters.

tadman
This lib is a set of ruby classes which do a bunch of stuff(read from xml,parse it ,call a service,collect data) and then throws back result to my Ruby on rails web app. Now my controller instantiates the main class from this lib and then waits for it to do all the stuff and give back a result.If i set time for the server wouldnt it affect other parts of the web app.Shouldnt i have a mechanism so that just this controller waits till for the result? i mean something like AJAX may be
The timeout is set server-wide usually, but if other parts of your app respond quickly it shouldn't be a problem. This only sets the tolerance for slow results, so it shouldn't break anything. Using AJAX to fetch the slow portion of your page is a good idea, too, as you can render a placeholder first so at least the application appears to be working. You can put a spinner where the content will eventually appear.
tadman