Re: Very long operations with FastCGI
Marc Prewitt <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Jason P Sage wrote: >... > > The bottom line is that my BIG PROCESS sends out a message warning its > going to take awhile (right away!) to the user, with a link back to my > main menu. When the main menu “draws” it scans for these “big process” > static out files, and if they exist, the main page has a little “area” > with however many of these “generated static” files might be there for > this user. Then the user can click the link (because its only a link > when the big process is finished and the resultant file is moved to the > “static web directory”) and see the result whenever. > > ... >> -----Original Message----- >> *From:* >> fastcgi-developers-bounces+jasonpsage=jegas.com-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org >> [mailto:fastcgi-developers-bounces+jasonpsage=jegas.com-xGejAJT2w6x8daDhuVx7AA@public.gmane.orgi.com] >> *On Behalf Of *Mitch Jackson >> *Sent:* Thursday, August 10, 2006 7:48 PM >> *To:* fastcgi-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org >> *Subject:* [FASTCGI] Very long operations with FastCGI >> >> >> >> I have a long-running operation to spawn from a perl script within the >> FastCGI environment. I would like the script to cause the user's >> browser to redirect to a 'view operation status' page, and continue to >> do the processing of the operation in the background. I see two obvious >> ways to do this. First using the HTTP header 'redirect: [url]' and the >> other by writing a page with a meta refresh tag. >> >> Once I have written a redirect command to the user's browser, how do I >> signal to the server and the browser that i'm done sending input, so the >> server will flush the buffer and deliver the output, and the browser >> will acknowledge this session has completed and do it's thing, instead >> of waiting for more output from the web server. >> >> Thanks, >> >> /mitch A similar way to do this is to: - generate a unique landing page which contains a meta refresh to reload itself every x seconds. - send back a redirect to the browser to go to the above page. - Fork off a process which does the actual processing (otherwise the fcgi process manager may time out and kill you.) - The forked process when done overwrites the landing page with the results. - The next time the browser reloads it gets the completed landing page. ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/