Commit 67b1d475 authored by Tres Seaver's avatar Tres Seaver

Make the maximum number of retries on ConflictError a configuration option.

 fixes lp:143013 on this branch
parent 4d2db1b8
......@@ -15,6 +15,9 @@ Features Added
- zope.i18nmessageid = 3.5.1
- LP #143013: make the maximum number of retries on ConflictError a
configuration option.
Bugs Fixed
++++++++++
......
......@@ -207,12 +207,17 @@ def root_handler(config):
# set up trusted proxies
if config.trusted_proxies:
import ZPublisher.HTTPRequest
from ZPublisher import HTTPRequest
# DM 2004-11-24: added host name mapping (such that examples in
# conf file really have a chance to work
mapped = []
for name in config.trusted_proxies: mapped.extend(_name2Ips(name))
ZPublisher.HTTPRequest.trusted_proxies = tuple(mapped)
HTTPRequest.trusted_proxies = tuple(mapped)
# set the maximum number of ConflictError retries
if config.max_conflict_retries:
from ZPublisher import HTTPRequest
HTTPRequest.retry_max_count = config.max_conflict_retries
def handleConfig(config, multihandler):
......
......@@ -208,6 +208,19 @@ class StartupTestCase(unittest.TestCase):
self.assertEqual(conf.databases[0].config.connection_class.__name__,
'LowConflictConnection')
def test_max_conflict_retries_default(self):
conf, handler = self.load_config_text("""\
instancehome <<INSTANCE_HOME>>
""")
self.assertEqual(conf.max_conflict_retries, 3)
def test_max_conflict_retries_explicit(self):
conf, handler = self.load_config_text("""\
instancehome <<INSTANCE_HOME>>
max-conflict-retries 15
""")
self.assertEqual(conf.max_conflict_retries, 15)
def test_suite():
return unittest.makeSuite(StartupTestCase)
......
......@@ -653,6 +653,12 @@
<metadefault>unset</metadefault>
</multikey>
<key name="max-conflict-retries" datatype="integer" default="3" attribute="max_conflict_retries">
<description>
The maximum number of retries on a conflict error
</description>
</key>
<key name="security-policy-implementation"
datatype=".security_policy_implementation"
default="C">
......
......@@ -826,6 +826,18 @@ instancehome $INSTANCE
#
# conflict-error-log-level blather
# Directive: max-conflict-retries
#
# Description:
# Specifies how many times a transaction will be re-tried when
# it generates ConflictErrors. This can be a problem when using
# a ZEO server and you have large numbers of simultaneous writes.
#
# Default: 3
#
# Example:
#
# max-conflict-retries 10
# Directive: warnfilter
#
......
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