[Zope] Return results immediately but continue processing

Dieter Maurer dieter@handshake.de
Wed, 4 Dec 2002 21:41:09 +0100


Oliver Bleutgen writes:
 > Dieter Maurer wrote:
 > [About finding out if the client closes the connection ...]
 > 
 > > 
 > >   The "RESPONSE" object has a connection to the channel with
 > >   high probability. Start your exploration there.
 > 
 > 
 > Totally guessing here, but maybe it's worth trying if RESPONSE.write() 
 > throws an exception if the connection is closed.
I would not expect it.

The medusa thread controlling the channel and the Zope "worker" thread
are decoupled by a so called "producer". "write" appends to the producer.

 > If not, it should.
Maybe, but

   "RESPONSE.write" is (should be) used only in exceptional cases.

   You want an additional way to signal the worker thread that
   what it does in no longer of interest.

   Some flag, it may check or (even better) an appropriate
   signal (which formerly was delivered only to the main
   thread but now might also be delivered to other threads (when
   I understood this correctly)).



Dieter