Pete, you said "don't generate the result unless you know someone's
going to use it."

That's the point of having a way to poll if the browser is still there -
to see if they are going to use it.

We do control # of requests, but it isn't straightforward.  All of the
code has to be very controlled with catches around everything to ensure
that if any error occurs, the count of current requests gets decremented,
no error returns while the count is incremented, etc.

If someone double-clicks, it's much easier to just add "if client has
died, stop" rather than a shared data structure to see if they are
running twice, and you still have the problem of how to stop the first
process when the second one starts up (because of double-clicking).

If someone says "show me a traffic summary for the last 2 years, by
week, ordered by blah", it may not be trivial to generate that kind of
report.  So it does hurt to keep on doing it when no one is listening.

Jim

> But here's the thing -- what does it waste to keep running when the client
> is gone?  For most web applications (in my opinion), I think it doesn't
> hurt anything to finish generating the result even when nobody's listening
> anymore, and it makes programming significantly more complex.  If
> generating the result is going to cost you something, then don't generate
> the result unless you know someone's going to use it.  If you can't do
> that, and it's still going to cost you something, then you need to control
> how many requests you'll process at any one time.  Programming it this way
> is simple, and will work in any web application framework.  I really think
> trying to control the dialog with the visitor, even if only to notice that
> they aren't listening anymore, is the wrong paradigm for web programming.
>
> Pete.
>
> On Wed, 19 Dec 2001, Jim Wilcoxson wrote:
>
> > I don't know how to do it (tried a bunch of things), but agree it would
> > be nice to know if the browser side of the connection has died because of
> > a user hitting escape or whatever.  Some processes may take several minutes.
> > If a user gets impatient or double-clicks, it's a waste to keep running
> > when the client is gone.  Some way to poll for this would be cool...
>

Reply via email to