[[email protected]: Re: [mod_python] [patch] make autoreload more useful]

Martin Pool mbp at samba.org
Thu May 30 11:02:10 EST 2002

On 29 May 2002, Dustin Mitchell <dustin at ywlcs.org> wrote:

> Right, and in a development environment (the only place one would use a
> reloader) I suppose that would be acceptable.  However, if you're testing
> against the production database server (a not-unreasonable proposition for a
> small to midsize shop with a complex database schema), all those extra
> connections might prove to be a burden.  And you can't guarantee that Python
> will close them when the module is "unloaded", as the module may continue to
> exist for some time.

(I realize it's only an example.)

How often are developers changing and testing their code -- every few
minutes at most?  Suppose every ten seconds on average if you have a
few developers.  If your database can't cope with merely opening and
closing connections at that frequency I think you have big problems
that need to be addressed in some other way.  (More hardware, local
cache, ...)

It's equally or more likely that holding idle connections open
indefinitely would cause resource problems.

Anyhow, such a shop could always forbid use of the reloader.  There's
no need to penalize all users for the sake of this rare and
hypothetical case.

> Regarding permanent variables, under ordinary Python reload semantics, you
> can do something like:

I guess you could just stick the reference into somewhere in sys, but
of course that might result in other modules that you *do* want to
have reloaded actually not being so.

I think the real problem is that without reloading, if you ever forget
to restart Apache, different apache children can have different
versions of the code, which is very confusing.


More information about the Mod_python mailing list