Potential fix for locked database when using !seen
parent
58b9ec7025
commit
7e0c3ffbe8
4
seen.py
4
seen.py
|
@ -60,12 +60,15 @@ def seen(phenny, input):
|
||||||
|
|
||||||
print("[LOG]: %s queried Seen Result for %s" % (input.nick,nick))
|
print("[LOG]: %s queried Seen Result for %s" % (input.nick,nick))
|
||||||
|
|
||||||
|
update_l.acquire()
|
||||||
db = opendb()
|
db = opendb()
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute("SELECT channel, time FROM seen WHERE nick = ?", (nick,))
|
c.execute("SELECT channel, time FROM seen WHERE nick = ?", (nick,))
|
||||||
r = c.fetchone()
|
r = c.fetchone()
|
||||||
c.close()
|
c.close()
|
||||||
db.close()
|
db.close()
|
||||||
|
update_l.release()
|
||||||
|
|
||||||
if r:
|
if r:
|
||||||
channel, t = r[0], r[1]
|
channel, t = r[0], r[1]
|
||||||
t = time.strftime('%Y-%m-%d %H:%M:%S UTC', time.gmtime(t))
|
t = time.strftime('%Y-%m-%d %H:%M:%S UTC', time.gmtime(t))
|
||||||
|
@ -76,6 +79,7 @@ def seen(phenny, input):
|
||||||
phenny.reply("Sorry, I haven't seen %s around." % nick)
|
phenny.reply("Sorry, I haven't seen %s around." % nick)
|
||||||
|
|
||||||
seen.rule = (['seen'], r'(\S+)')
|
seen.rule = (['seen'], r'(\S+)')
|
||||||
|
seen.thread = True
|
||||||
|
|
||||||
def note(phenny, input):
|
def note(phenny, input):
|
||||||
if input.sender.startswith('#'):
|
if input.sender.startswith('#'):
|
||||||
|
|
Loading…
Reference in New Issue