Commit b8a96ebf authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Kazuhiko Shiozaki

Products.CMFActivity.SQLBase: Always commit before returning

Committing serves two purposes:
- obviously: it makes any transactional data change persistent
- less obviously: it releases the database transactional snapshot taken by
  any previously issued query, allowing that snapshot and all snapshots
  after it to be also freed (ex: garbage collecting the data records that
  no other transaction can see)
In the current state of the code flow, this does not change much: after
this method returns the code flow should quickly hit a commit anyway,
either in dequeueMessage or before handing control back to timerserver,
thereby ending the Zope-initiated transaction.
But this will not be true in a future version of the code.
parent a1aee309
......@@ -683,8 +683,8 @@ CREATE TABLE %s (
while 1:
result = self._getMessageList(db, **where_kw)
if not result:
transaction.commit()
return
transaction.commit()
message_list = [Message.load(line.message, uid=line.uid, line=line)
for line in result]
message_set = self._getExecutableMessageSet(activity_tool, db, message_list)
......@@ -714,6 +714,7 @@ CREATE TABLE %s (
self.assignMessageList(db, 0, distributable_uid_set)
validated_count += distributable_count
if validated_count >= MAX_VALIDATED_LIMIT:
transaction.commit()
return
line = result[-1]
where_kw['above_priority_date_uid'] = (line.priority, line.date, line.uid)
......
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