summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw2008-03-12 21:22:48 -0400
committerBarry Warsaw2008-03-12 21:22:48 -0400
commit276df8d3a8e89013490d7048b21ddc87e75a38ac (patch)
tree3a9a4e50a7c6a7ee2829d37127a5ff4522089a62
parent91f84edd80b4470cb0c9dfca30890388af6daec8 (diff)
downloadmailman-276df8d3a8e89013490d7048b21ddc87e75a38ac.tar.gz
mailman-276df8d3a8e89013490d7048b21ddc87e75a38ac.tar.zst
mailman-276df8d3a8e89013490d7048b21ddc87e75a38ac.zip
Sprinkle a few more transaction API calls around to make sure the database
doesn't remain in a locked state, hosing other processes. - Move a commit to the end of StockDatabase._create() - Add an abort to the Exception clause if there's an error while dequeuing - Add an abort to the Exception clause if there's an error while finishing - Add a commit after _doperiodic() and _shortcircuit() is called. - Add a commit to the end of cleaning_teardown() in test_documentation.py This now makes all the tests pass even when all of them are run.
Diffstat (limited to '')
-rw-r--r--mailman/database/__init__.py2
-rw-r--r--mailman/queue/__init__.py5
-rw-r--r--mailman/tests/test_documentation.py1
3 files changed, 6 insertions, 2 deletions
diff --git a/mailman/database/__init__.py b/mailman/database/__init__.py
index dabe70c79..1f73071c0 100644
--- a/mailman/database/__init__.py
+++ b/mailman/database/__init__.py
@@ -121,7 +121,6 @@ class StockDatabase:
sql = fp.read()
for statement in sql.split(';'):
store.execute(statement + ';')
- store.commit()
# Validate schema version.
v = store.find(Version, component=u'schema').one()
if not v:
@@ -133,6 +132,7 @@ class StockDatabase:
# XXX Update schema
raise SchemaVersionMismatchError(v.version)
self.store = store
+ store.commit()
def _reset(self):
"""See `IDatabase`."""
diff --git a/mailman/queue/__init__.py b/mailman/queue/__init__.py
index fb6b07479..e30608138 100644
--- a/mailman/queue/__init__.py
+++ b/mailman/queue/__init__.py
@@ -274,6 +274,7 @@ class Runner:
log.error('Skipping and preserving unparseable message: %s',
filebase)
self._switchboard.finish(filebase, preserve=True)
+ config.db.abort()
continue
try:
self._onefile(msg, msgdata)
@@ -303,11 +304,13 @@ class Runner:
log.error('SHUNTING FAILED, preserving original entry: %s',
filebase)
self._switchboard.finish(filebase, preserve=True)
- # Other work we want to do each time through the loop
+ config.db.abort()
+ # Other work we want to do each time through the loop.
Utils.reap(self._kids, once=True)
self._doperiodic()
if self._shortcircuit():
break
+ config.db.commit()
return len(files)
def _onefile(self, msg, msgdata):
diff --git a/mailman/tests/test_documentation.py b/mailman/tests/test_documentation.py
index 9f46e55c8..69acd9d7b 100644
--- a/mailman/tests/test_documentation.py
+++ b/mailman/tests/test_documentation.py
@@ -77,6 +77,7 @@ def cleaning_teardown(testobj):
# Clear out messages in the message store.
for message in config.db.message_store.messages:
config.db.message_store.delete_message(message['message-id'])
+ config.db.commit()