disable queue until bug fixed

This commit is contained in:
Alan Hamlett 2014-05-26 14:06:36 -07:00
parent e5e399dfbe
commit 17fd6ef8e1

View file

@ -24,7 +24,6 @@ class Queue(object):
DB_FILE = os.path.join(os.path.expanduser('~'), '.wakatime.db') DB_FILE = os.path.join(os.path.expanduser('~'), '.wakatime.db')
def connect(self): def connect(self):
exists = os.path.exists(self.DB_FILE)
conn = sqlite3.connect(self.DB_FILE) conn = sqlite3.connect(self.DB_FILE)
c = conn.cursor() c = conn.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS action ( c.execute('''CREATE TABLE IF NOT EXISTS action (
@ -41,6 +40,7 @@ class Queue(object):
def push(self, data, plugin): def push(self, data, plugin):
try:
conn, c = self.connect() conn, c = self.connect()
action = { action = {
'file': data.get('file'), 'file': data.get('file'),
@ -55,13 +55,20 @@ class Queue(object):
c.execute('INSERT INTO action VALUES (:file,:time,:project,:language,:lines,:branch,:is_write,:plugin)', action) c.execute('INSERT INTO action VALUES (:file,:time,:project,:language,:lines,:branch,:is_write,:plugin)', action)
conn.commit() conn.commit()
conn.close() conn.close()
except sqlite3.Error, e:
log.error(str(e))
def pop(self): def pop(self):
return None
tries = 3 tries = 3
wait = 0.1 wait = 0.1
action = None action = None
try:
conn, c = self.connect() conn, c = self.connect()
except sqlite3.Error, e:
log.debug(str(e))
return None
loop = True loop = True
while loop and tries > -1: while loop and tries > -1:
try: try:
@ -69,6 +76,7 @@ class Queue(object):
c.execute('SELECT * FROM action LIMIT 1') c.execute('SELECT * FROM action LIMIT 1')
row = c.fetchone() row = c.fetchone()
if row is not None: if row is not None:
log.info(row)
c.execute('''DELETE FROM action WHERE c.execute('''DELETE FROM action WHERE
file=? AND time=? AND project=? AND language=? AND file=? AND time=? AND project=? AND language=? AND
lines=? AND branch=? AND is_write=?''', row[0:7]) lines=? AND branch=? AND is_write=?''', row[0:7])
@ -89,5 +97,8 @@ class Queue(object):
log.debug(str(e)) log.debug(str(e))
sleep(wait) sleep(wait)
tries -= 1 tries -= 1
try:
conn.close() conn.close()
except sqlite3.Error, e:
log.debug(str(e))
return action return action