[FIX] don't rollback() transation, use savepoint. This fixes concurrency
issues with long running cron threads as rollback also releases the lockpull/3071/head
parent
bec5ca112b
commit
fe1379c3be
|
@ -148,14 +148,15 @@ class fetchmail_server(Model):
|
||||||
if found_ids and (len(found_ids) == 1 or
|
if found_ids and (len(found_ids) == 1 or
|
||||||
folder.match_first):
|
folder.match_first):
|
||||||
try:
|
try:
|
||||||
|
cr.execute('savepoint apply_matching')
|
||||||
match_algorithm.handle_match(
|
match_algorithm.handle_match(
|
||||||
cr, uid, connection,
|
cr, uid, connection,
|
||||||
found_ids[0], folder, mail_message,
|
found_ids[0], folder, mail_message,
|
||||||
msgdata[0][1], msgid, context)
|
msgdata[0][1], msgid, context)
|
||||||
cr.commit()
|
cr.execute('release savepoint apply_matching')
|
||||||
matched_object_ids += found_ids[:1]
|
matched_object_ids += found_ids[:1]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cr.rollback()
|
cr.execute('rollback to savepoint apply_matching')
|
||||||
logger.exception(
|
logger.exception(
|
||||||
"Failed to fetch mail %s from %s",
|
"Failed to fetch mail %s from %s",
|
||||||
msgid, this.name)
|
msgid, this.name)
|
||||||
|
|
Loading…
Reference in New Issue