durusmail: quixote-users: Making Quixote work in a threaded Web server.
Making Quixote work in a threaded Web server.
2002-10-04
2002-10-04
2002-10-04
2002-10-04
2002-10-06
2002-10-07
2002-10-16
2002-10-16
2002-10-16
2002-10-16
2002-10-17
2002-10-17
2002-10-17
2002-10-16
2002-10-16
Making Quixote work in a threaded Web server.
Greg Ward
2002-10-04
On 03 October 2002, Titus Brown said:
> I've made Quixote run in a multi-threaded environment, and this work has
> suggested a few changes that I'd like to make in the distribution.  I don't
> think any of them are particularly unreasonable ;).

Excellent!  I'm all ears.  I'd like to wring a "multi-threaded Quixote"
document out of you if possible.

> It seems like some reorganization along these lines has already been done
> in 0.5.1, but I haven't seen the code yet; these suggestions are all made
> against the 0.5 codebase.

You should defintely get the 0.5.1 code out of CVS, then.  Andrew
rearranged responsibilities between publish(), try_publish(), and
parse_request(), and added a process_request() method -- all of these
changes directly affect what you're trying to do.

> * Can Publisher.start_time be moved to HTTPRequest?

Hmmm, that sounds sensible to me.

> * At the end of 'try_publish', can the _request object be invalidated in
>       some manner?  (Preferably in a function that I can override in a
>       subclass of Publisher, like parse_request() but for deleting the
>       request.)  The distinction between this and the finish_*_request
>       functions is that this function should ALWAYS be called independently
>       of the session manager etc. stuff.

Look at process_request() in the current CVS code.  I think the thing to
do is put a try/finally clause in there, and clear _request in the
"finally".  That's not subclass-friendly, but it puts responsibility for
maintaining the global in one place.

> * Can get_request call a function on _publisher, i.e. make _request be a
>       member of Publisher grabbed through an accessor fn?  I can't
>       override the functionality of get_request, as-is, because it is
>       a module function.

As long as there's one global _publisher, there might as well be one
global _request.  I don't think you can change this by subclassing --
you'll have to give us a patch to transform those globals into dicts.
(There would always be at most one Publisher per thread, so just map
thread ID to Publisher object.  Ditto for _request.)

>       It would also be nice to have parse_request() set _request through
>       an accessor function, for the same reason.  This could be in
>       either start_request() or parse_request().

That's all different in the current code -- again, see process_request().

        Greg
--
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org


reply