Re: FATAL: sorry, too many clients already

Christoph Zwerschke <[email protected]>
Newsgroups gmane.comp.python.webware
Message-ID <[email protected]>
[email protected] wrote:
> Where do I call closeDB in db.py

Actually this is a web.py specific question, so I suggest moving the 
discussion to the web.py mailing list.

I have just had a short look at web.py and yes it's a nice framework, 
very Spartan, but that may be just right for some kinds of projects. 
I'll follow that mailing list for a while.

To answer your question anyway: You shouldn't close anything when using 
the web.py database automatism. For simplicity, web.py keeps the 
connection while it is serving one URL, then it will be destroyed and 
automatically returned to the pool. I believe that should work fine, 
though it could be optimized. So leave db.py as it is.

However, you may need to define a limit to the numer of connections, 
like that:

     web.config.db_parameters = dict(
         dbn='postgres', user='scott', pw='tiger', db='foo',
         maxconnections=100, blocking=True)

Can you try that out and let me know whether it helps?

-- Christoph

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.