Read then write sqlite transactions must use BEGIN IMMEDIATE

This commit is contained in:
Stuart Gathman
2013-02-25 19:10:57 +00:00
parent ff06b5f1b4
commit 078d9f2078
+1 -1
View File
@@ -35,7 +35,7 @@ class Greylist(object):
def check(self,ip,sender,recipient,timeinc=0): def check(self,ip,sender,recipient,timeinc=0):
"Return number of allowed messages for greylist triple." "Return number of allowed messages for greylist triple."
cur = self.conn.cursor() cur = self.conn.execute('begin immediate')
try: try:
cur.execute('''select firstseen,lastseen,cnt,umis from greylist where cur.execute('''select firstseen,lastseen,cnt,umis from greylist where
ip=? and sender=? and recipient=?''',(ip,sender,recipient)) ip=? and sender=? and recipient=?''',(ip,sender,recipient))