[thelist] Downloading a Compiled CSV File without timing out

Bill Moseley moseley at hank.org
Thu Oct 29 15:14:34 CDT 2009


On Thu, Oct 29, 2009 at 12:37 PM, Rob <robbiesmith79 at gmail.com> wrote:

> Hi List,
>
> Long time no see, must be at least 4 years since I've helped out here.
>
> I have a unique situation where I seek your expertise. My hosting company
> uses a controller that monitors all php activity. If a script seems to be
> running for more than 30 - 60 seconds it'll will kill the script.
>
> The situation is this. The client needs to be able to download a csv
> version
> of the database sometimes with a filter applied. At first it was fine
> because there wasn't that much data, now the same script is taking this
> long
> because of having to compile the csv file, hense timing out.
>

What about backgrounding the task?  Fork the web server and have it run the
task, or queue it in the database and have cron pickup the task.
Return right away to the browser providing a link they can check back
later.  While on that page use Ajax to test for the job to be completed and
then
redirect to return the CSV file.  On other pages you can check the queue and
display if they have any completed "jobs" and provide a link.

"Your order is ready for pickup!"

Tell the hosting service that you have long running tasks and leave them
alone.




-- 
Bill Moseley
moseley at hank.org



More information about the thelist mailing list