Re: RE: [PHP] flushing AJAX scripts
| From: | jim white | Date: | Sat, 28 Mar 2009 04:47:42 +0000 |
| Subject: | Re: RE: [PHP] flushing AJAX scripts | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290783@lists.php.net to get a copy of this message | ||
Well, the point was that I had tried the first way, submitting one AJAX request and waiting for it to finish and it was timing out, probably on my firewall which it shouldn't have - but it did. The reports can take 10 seconds or 10 minutes to create. Doing it this way I can still load the report even if the original request shuts down after 3-4 minutes.
Jim
Andrea Giammarchi wrote:
Sorry Jim, I meant Jim when I wrote Kim ... and Phico: http://webreflection.blogspot.com/2008/04/phomet-changes-name-so-welcome-phico.html Regards_________________________________________________________________ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx -- James (Jim) B. White tel: (919)-380-9615 homepage: http://jimserver.net/From: an_red@hotmail.com To: php-general@lists.php.net Date: Fri, 27 Mar 2009 15:55:28 +0100 Subject: RE: [PHP] flushing AJAX scripts Sorry, Kim, but why on earth you are polling with a second request to know when the first one has finished? I mean, when the first request inserts data in the database that's it, you'll manage the end of the request. $A ---> do stuff; do stuff; do stuff; report ready; $B ---> report ready? $B ---> report ready? $B ---> report ready? $B ---> report ready? report ready; ---> notification to A $B ---> report ready; the report ready, if it is when $A request has been finished, will be in $A, the polling via $B is absolutely useless, imo. There is no timeout from Ajax, it simply keep waiting, but obviously if your PHP has max_execution_time 30 seconds and the script execution takes more than 30 seconds there's no polling that could save you. The same if the user closes the browser, connection lost, bye bye response. To have a notice, you need Comet, try out Phico but still, a page that requires that much is not suitable for the web. Report creation should be a cronjob in a separed thread if it is that stressful. Regards_________________________________________________________________ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspxFrom: jbw2003@earthlink.net To: an_red@hotmail.com CC: php-general@lists.php.net Subject: Re: RE: [PHP] flushing AJAX scripts My page submits the AJAX request to complete a report that takes some time, and upon completion stores results in a database. A second AJAX request polls every 5 seconds and queries the database if the report is ready. This hopefully will get around any timeout problems I am having with a long running request, and seems to be working. It looks like I can accept the default behavior for now. I don't depend on getting a response from the original request, but is there a point where the AJAX response script will be stopped either by Apache or PHP before it can insert into the database? JimDate: Fri, 27 Mar 2009 10:47:10 -0400