Commit ee492fec authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

CMFActivity: commit DB transaction properly so that another transaction starts explicitly.

parent ef452f13
......@@ -835,8 +835,9 @@ CREATE TABLE %s (
"""
Put messages back in given processing_node.
"""
db.query("UPDATE %s SET processing_node=%s WHERE uid IN (%s)\0COMMIT" % (
db.query("UPDATE %s SET processing_node=%s WHERE uid IN (%s)" % (
self.sql_table, state, ','.join(map(str, uid_list))))
db._finish()
def getProcessableMessageLoader(self, db, processing_node):
# do not merge anything
......@@ -885,8 +886,9 @@ CREATE TABLE %s (
# new transaction starts on the first 'FOR UPDATE' query, which is all
# the more important as the current on started with getPriority().
result = db.query(b"SELECT * FROM %s WHERE processing_node=%d"
b" ORDER BY priority, date LIMIT 1\0COMMIT" % (
b" ORDER BY priority, date LIMIT 1" % (
str2bytes(self.sql_table), processing_node), 0)
db._finish()
already_assigned = result[1]
if already_assigned:
result = Results(result)
......
......@@ -142,10 +142,10 @@ class SQLDict(SQLBase):
if reserve_uid_list:
self.assignMessageList(db, processing_node, reserve_uid_list)
else:
db.query("COMMIT") # XXX: useful ?
db._finish() # XXX: useful ?
except:
self._log(WARNING, 'Failed to reserve duplicates')
db.query("ROLLBACK")
db._abort()
raise
if uid_list:
self._log(TRACE, 'Reserved duplicate messages: %r' % uid_list)
......
......@@ -166,10 +166,10 @@ CREATE TABLE %s (
if uid_list:
self.assignMessageList(db, processing_node, uid_list)
else:
db.query("COMMIT") # XXX: useful ?
db._finish() # XXX: useful ?
except:
self._log(WARNING, 'Failed to reserve duplicates')
db.query("ROLLBACK")
db._abort()
raise
if uid_list:
self._log(TRACE, 'Reserved duplicate messages: %r' % uid_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment