Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: users

Stoping the handler if connection is dropped

 

 

Cherokee users RSS feed   Index | Next | Previous | View Threaded


skinkie at xs4all

Jun 1, 2008, 8:37 PM

Post #1 of 2 (255 views)
Permalink
Stoping the handler if connection is dropped

How can one check in the handler if the connection is still active?

Basically; if processing of SQL takes long and someone starts pressing
F5 you don't want to process everything again n-times total. If only the
last time goes to the user.


Stefan
_______________________________________________
Cherokee mailing list
Cherokee[at]cherokee-project.com
http://cherokee-project.com/cgi-bin/mailman/listinfo/cherokee


alvaro at gnu

Jun 2, 2008, 12:53 AM

Post #2 of 2 (238 views)
Permalink
Re: Stoping the handler if connection is dropped [In reply to]

On 2 Jun 2008, at 05:37, Stefan de Konink wrote:

> How can one check in the handler if the connection is still active?
>
> Basically; if processing of SQL takes long and someone starts pressing
> F5 you don't want to process everything again n-times total. If only
> the
> last time goes to the user.

When you force your browser to reload, if closes the connection and
opens a new one.. which means that cherokee will close the internal
connection as well. When a server connection is closed, the handler is
freed.

The best approach for your case would be to set a global "proxy"
object. This object would handle the connection to your data source,
and in case your handler requests the same object twice (from
different client connections), it would just keep one connection open.

By the way, the proxy object must be thread safe. Something like a
monitor [1] would be fairly easy to implement..

1.- http://en.wikipedia.org/wiki/Monitor_%28synchronization%29

--
Greetings, alo.
http://www.alobbs.com/

_______________________________________________
Cherokee mailing list
Cherokee[at]cherokee-project.com
http://cherokee-project.com/cgi-bin/mailman/listinfo/cherokee

Cherokee users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.