javascript - ajax queries still waiting after window close -
i have webpage has ajax call gets data php script.
ajaxrequest = new xmlhttprequest(); ajaxrequest.open("get", "submit.php?id=" + id, true); ajaxrequest.send(null);
inside submit.php wait binary finish , create outfile.
while(1){ if(is_file($outfilepath)){ break; }else{ sleep(60); } }
the problem if user closes browser window, ajax call , corresponding httpd not aborted.
and if user refreshes webpage multiple times, end having hundreds of httpd processes waiting the same outfile created.
apache server status 115 requests being processed, 5 idle workers wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww_w____........ ................................................................ ................................................................ scoreboard key: "_" waiting connection, "s" starting up, "r" reading request, "w" sending reply, "k" keepalive (read), "d" dns lookup,
i believe answer needed send data client (which closed), , causes php realize connection has been closed, have exit script.
while(1){ if(is_file($outfilepath)){ break; }else{ sleep(60); print " "; ob_flush(); flush(); if(connection_aborted() != 0{ exit; } } }
Comments
Post a Comment