Re: [Zope] PyGres DB Connection in Zope drops when many Users are added(UserDB)(UserDB) - Mailing list pgsql-general

From Hannu Krosing
Subject Re: [Zope] PyGres DB Connection in Zope drops when many Users are added(UserDB)(UserDB)
Date
Msg-id 390581AD.E74DCDF0@tm.ee
Whole thread Raw
In response to PyGres DB Connection in Zope drops when many Users are added (UserDB)  (Stephan Richter <srichter@cbu.edu>)
List pgsql-general
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

pgsql-general by date:

Previous
From: "J. Atwood"
Date:
Subject: Re: [Zope] PyGres DB Connection in Zope drops when many Users are added (UserDB) (UserDB)
Next
From: Thomas Good
Date:
Subject: Re: Is 7.0 ready? -> DBD as well???