From f694ff70e148b4bc67560593f106f12f0de2f2b2 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 5 Dec 2005 13:56:02 +0000 Subject: [PATCH] try to fix a db locked that sometimes happens --- src/common/logger.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/logger.py b/src/common/logger.py index 2275a45d9..a70332141 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -76,6 +76,8 @@ constants = Constants() class Logger: def __init__(self): + self.jids_already_in = [] # holds jids that we already have in DB + if not os.path.exists(LOG_DB_PATH): # this can happen only the first time (the time we create the db) # db is not created here but in src/common/checks_paths.py @@ -93,7 +95,6 @@ class Logger: def get_jids_already_in_db(self): cur.execute('SELECT jid FROM jids') rows = cur.fetchall() # list of tupples: (u'aaa@bbb',), (u'cc@dd',)] - self.jids_already_in = [] for row in rows: # row[0] is first item of row (the only result here, the jid) self.jids_already_in.append(row[0]) @@ -201,12 +202,11 @@ class Logger: jids.jid text column will hold JID if TC-related, room_jid if GC-related, ROOM_JID/nick if pm-related.''' - if not hasattr(self, 'get_jids_already_in_db'): + if self.jids_already_in == []: # only happens if we just created the db global con, cur con = sqlite.connect(LOG_DB_PATH, timeout = 20.0, isolation_level = 'IMMEDIATE') cur = con.cursor() - self.get_jids_already_in_db() jid = jid.lower() contact_name_col = None # holds nickname for kinds gcstatus, gc_msg