I'm confused. You're calling this a recipe for DbPool, but I don't see any usage of DbPool in your sample code below...
What exactly does the "UserStore" do? Is DbPool wrapped into it somehow? - Geoff > -----Original Message----- > From: Costas Malamas [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 21, 2002 6:51 AM > To: [EMAIL PROTECTED] > Subject: [Webware-discuss] A recipe for DbPool (maybe) > > > > If y'all remember, I have had issues with WK crashing without > a traceback. > Much research later, my suspicions centered on MySQL for > Python: basically, > I figured that since I was not using a threadsafe DB link to > WK, at some > point MySQL was killing the connection to WK, which brought WK down, > probably via the mysqldb module. > > The only real way to verify this, was to switch to DBPool and > see if that > fixed my stability issues. The problems there were that a) > my ORM code is > used by other non-WK python code that is not threaded, and b) > that I already > have kLOCs of code in place (check it out: http://memigo.com/). > > So, I came up with a solution that maybe a nice recipe for > using DBPool; or > it maybe brain-dead, and that's why I wanna run it by y'all > (I will say > though that it has fixed my stability problems for good). > > My ORM classes all inherit from a class called Store. I added > an optional > switch to Store, threaded, and a connect() and disconnect() > method. Now, in > the constructor of my WK Page servlets, I changed calls like this: > self.userstore = UserStore() > > to this: > self.userstore = self.addStore(UserStore) > > (you will notice that is a simple regex job). Where: > > class SitePage(Page): > ... > > def addStore(storeClass): > storeObj = storeClass(threaded=1) > self._stores.append(storeObj) > return storeObj > > def respond(self, trans): > for store in self._stores: > store.connect() > Page.respond(self, trans) > for store in self._stores: > store.disconnect() > > So, far, crashes have gone away, and the whole migration took > about 1-2 > hours of running greps and seds and verifying the results. > What do y'all > think? Is this a valid approach or can it be done faster/better? > > Thanks, > > Costas > > > > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > Webware-discuss mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/webware-discuss > ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
