update wakatime package to v2.0.1
This commit is contained in:
parent
64ea40b3f5
commit
e56a07e909
3 changed files with 25 additions and 9 deletions
|
@ -3,6 +3,12 @@ History
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
||||||
|
2.0.1 (2014-05-26)
|
||||||
|
++++++++++++++++++
|
||||||
|
|
||||||
|
- fix bug in queue preventing actions with NULL values from being purged
|
||||||
|
|
||||||
|
|
||||||
2.0.0 (2014-05-25)
|
2.0.0 (2014-05-25)
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
__title__ = 'wakatime'
|
__title__ = 'wakatime'
|
||||||
__version__ = '2.0.0'
|
__version__ = '2.0.1'
|
||||||
__author__ = 'Alan Hamlett'
|
__author__ = 'Alan Hamlett'
|
||||||
__license__ = 'BSD'
|
__license__ = 'BSD'
|
||||||
__copyright__ = 'Copyright 2014 Alan Hamlett'
|
__copyright__ = 'Copyright 2014 Alan Hamlett'
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import traceback
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,14 +61,13 @@ class Queue(object):
|
||||||
|
|
||||||
|
|
||||||
def pop(self):
|
def pop(self):
|
||||||
return None
|
|
||||||
tries = 3
|
tries = 3
|
||||||
wait = 0.1
|
wait = 0.1
|
||||||
action = None
|
action = None
|
||||||
try:
|
try:
|
||||||
conn, c = self.connect()
|
conn, c = self.connect()
|
||||||
except sqlite3.Error, e:
|
except sqlite3.Error, e:
|
||||||
log.debug(str(e))
|
log.debug(traceback.format_exc())
|
||||||
return None
|
return None
|
||||||
loop = True
|
loop = True
|
||||||
while loop and tries > -1:
|
while loop and tries > -1:
|
||||||
|
@ -76,10 +76,20 @@ 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)
|
values = []
|
||||||
c.execute('''DELETE FROM action WHERE
|
clauses = []
|
||||||
file=? AND time=? AND project=? AND language=? AND
|
index = 0
|
||||||
lines=? AND branch=? AND is_write=?''', row[0:7])
|
for row_name in ['file', 'time', 'project', 'language', 'lines', 'branch', 'is_write']:
|
||||||
|
if row[index] is not None:
|
||||||
|
clauses.append('{0}=?'.format(row_name))
|
||||||
|
values.append(row[index])
|
||||||
|
else:
|
||||||
|
clauses.append('{0} IS NULL'.format(row_name))
|
||||||
|
index += 1
|
||||||
|
if len(values) > 0:
|
||||||
|
c.execute('DELETE FROM action WHERE {0}'.format(u' AND '.join(clauses)), values)
|
||||||
|
else:
|
||||||
|
c.execute('DELETE FROM action WHERE {0}'.format(u' AND '.join(clauses)))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
if row is not None:
|
if row is not None:
|
||||||
action = {
|
action = {
|
||||||
|
@ -94,11 +104,11 @@ class Queue(object):
|
||||||
}
|
}
|
||||||
loop = False
|
loop = False
|
||||||
except sqlite3.Error, e:
|
except sqlite3.Error, e:
|
||||||
log.debug(str(e))
|
log.debug(traceback.format_exc())
|
||||||
sleep(wait)
|
sleep(wait)
|
||||||
tries -= 1
|
tries -= 1
|
||||||
try:
|
try:
|
||||||
conn.close()
|
conn.close()
|
||||||
except sqlite3.Error, e:
|
except sqlite3.Error, e:
|
||||||
log.debug(str(e))
|
log.debug(traceback.format_exc())
|
||||||
return action
|
return action
|
||||||
|
|
Loading…
Reference in a new issue