Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping a long report 1

Status
Not open for further replies.

kingkoo

MIS
Jul 9, 2001
5
CA
Hi there
I have this asp screen (not .net just asp) where user can fill in report criteria and then when they hit the "Go" button, at which point the report page will be displayed. Sometimes the reports are quite big and may take 2 to 3 minutes to complete. If the user realizes he makes a mistake as soon as he gets to the report page, he may hit the "Stop" button and think the server has stopped generating the report, but it's not true. The server is still running the process. This is particularly more obvious for developers like myself cos I have the server installed on my workstation. When I hit the Stop button and then back to the report filter page and make some changes and then hit the Go again, it'll take 2 to 3 minutes before it'll show the report page this time, as if the server was trying to complete my last report first, before processing my current new request.

Question I have therefore, is, if I'm running a long server process, then how I can get the server to stop this thread (or process?) when the user hits the Stop button, or hits the Back button?

Many thanks.
King
 
Not sure you can lol,
One thing to reduce the load a little is to put in a response.flush call in your loops.

This seems to lessen the load a little, but as for stopping the process if you find an answer i need it as i have a report that takes nearlly 10 minutes that causes havoc!!

}...the bane of my life!
 
Hi there,
thanks but response.flush doesn't work, or not ideally anyway. It's still eating up CPUs on the server and I would like to eliminate that possibility altogether. I'm sure you know how I feel, considering you've got an even bigger report!! :)

Thanks
King
 
The problem is that the server doesn't really know what the browser client is doing... it only knows when the browser sends a request.

If your report process runs in a loop somehow, either in code or a stored procedure, you could use a table with a field for ASP Session ID and a timestamp of when the report was started... then, inside your reports loop, you could check to see if the timestamp has changed for the session id and exit out of the loop to kill the process.

 
Hi there

Actually what about this onstop event of document that HTML supports? Do you think it would help? I'm just trying to throw ideas. The method you quoted is a bit hard for me to understand - sorry I'm not very clear how the timestamp would have changed.....

Thanks
 
Trying to answer my own question but probably the answer is no.....

Onstop is a client event right? So if the user hits the Stop button, even though the OnStop event will fire, that won't let me be able to send a signal to the server to ask it to stop processing right?

One of my clients just told me that sometimes the report runs for 10 minutes because of how much data they have... This problem seems to be getting more serious for me now....

Any ideas?
Desperately
Thanks
 
why not check to see if client is connected? and then stop the service if not


<%
If response.IsClientConnected=true then
' process
else
response.end
end if
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top