Re: Please unblock bley/0.1.3-1
On Sun, Aug 15, 2010 at 03:10:33PM +0100, Adam D. Barratt wrote:
> On Sun, 2010-08-15 at 14:00 +0200, Evgeni Golov wrote:
> > please unblock bley/0.1.3-1 for Squeeze. The diff is attached, it
> > consists of the two upstream changes (both for stability: reconnect to
> > restarted databases and strip unicode chars from the input), a typo fix
> > in the long description, new standards version and quoted BSD license in
> > debian/copyright.
>
> Does the former fix also handle database issues that won't be fixed by
> continually trying to reconnect? (or at least might not be in the short
> term)
>
> For instance, if the database server is stopped or crashes, will bley
> sit in a never-ending loop trying to reconnect?
After short discussion on IRC with Adam, I've changed safe_execute to
look like this:
def safe_execute(self, query, params=None):
try:
self.dbc.execute(query, params)
except self.factory.settings.database.OperationalError:
try:
self.db.close()
except:
pass
self.db = None
retries = 0
while not self.db and retries < 30:
try:
self.db = self.factory.settings.database.connect(**self.factory.settings.dbsettings)
self.dbc = self.db.cursor()
except self.factory.settings.database.OperationalError:
self.db = None
retries += 1
sleep(1)
if self.db:
self.dbc.execute(query, params)
else:
self.factory.settings.logger('Could not reconnect to the database, exiting.\n')
reactor.stop()
and uploaded this as 0.1.4-1 (yes, new upstream ;)) to sid.
Please unblock this one instead.
TIA
--
Bruce Schneier can read and understand Perl programs.
Reply to: