[Zope] [GENERAL] PyGres DB Connection in Zope drops when many Users
are added(UserDB)(UserDB)
Hannu Krosing
hannu@tm.ee
Tue, 25 Apr 2000 14:29:49 +0300
Stephan Richter wrote:
>
> Hello everyone,
>
> This is a help message to every mailing list, I think this issue could be
> related to. We are in production and 5000 flyers (45000 follow) were sent
> out and the site keeps giving problems.
>
> I use:
> Zope 2.1.4, PyGres 2.x, Apache, and PostGres 7.0RC1
>
> The issue:
> It seems like that whenever "many" (10, I know that is not much) people
> sign up at the same time on our Web Site (http://www.plandepot.com), we
> loose the DB connection. The connection is simple restored, when
> disconnecting and the reconnecting the database.
And that's exactly how we quick-fixed it :)
def getUser(self, name):
"""Return the named user object or None if no such user exists"""
try: # koos elluäratamisega
try:
ob=self.sqlUserQuery(username=name)
except:
conn = getattr(self,self.conn_id)
conn.connect(conn.connection_string)
ob=self.sqlUserQuery(username=name)
except:
return None
if not ob:
return None
ob=ob[0]
return User(sqlattr(ob, 'username'),
sqlattr(ob, 'password'),
sqlattr(ob, 'roles'),
sqlattr(ob, 'domains'))
It does not find or solve the original problem, but at least it revives it
automatically
--------------
Hannu