Rev 4910: Add -Dnoretry as a way to disable all retrying code. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-reconnect-819604
John Arbash Meinel
john at arbash-meinel.com
Mon Oct 10 12:49:32 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-reconnect-819604
------------------------------------------------------------
revno: 4910
revision-id: john at arbash-meinel.com-20111010124914-12bq3apx7207nlbc
parent: john at arbash-meinel.com-20111010123331-9wilgl2mdut5fiw6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-client-reconnect-819604
timestamp: Mon 2011-10-10 14:49:14 +0200
message:
Add -Dnoretry as a way to disable all retrying code.
-------------- next part --------------
=== modified file 'bzrlib/help_topics/en/debug-flags.txt'
--- a/bzrlib/help_topics/en/debug-flags.txt 2010-01-05 04:30:07 +0000
+++ b/bzrlib/help_topics/en/debug-flags.txt 2011-10-10 12:49:14 +0000
@@ -24,6 +24,8 @@
-Dindex Trace major index operations.
-Dknit Trace knit operations.
-Dlock Trace when lockdir locks are taken or released.
+-Dnoretry If a connection is reset, fail immediately rather than
+ retrying the request.
-Dprogress Trace progress bar operations.
-Dmerge Emit information for debugging merges.
-Dno_apport Don't use apport to report crashes.
=== modified file 'bzrlib/smart/client.py'
--- a/bzrlib/smart/client.py 2011-10-10 12:33:31 +0000
+++ b/bzrlib/smart/client.py 2011-10-10 12:49:14 +0000
@@ -17,6 +17,7 @@
import bzrlib
from bzrlib.smart import message, protocol
from bzrlib import (
+ debug,
errors,
hooks,
trace,
@@ -237,7 +238,8 @@
# Connection is dead, so close our end of it.
self.client._medium.reset()
- if self.body_stream is not None:
+ if (('noretry' in debug.debug_flags)
+ or self.body_stream is not None):
# We can't restart a body_stream that has been partially
# consumed, so we don't retry.
raise
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py 2011-10-10 12:06:48 +0000
+++ b/bzrlib/tests/test_smart_transport.py 2011-10-10 12:49:14 +0000
@@ -28,6 +28,7 @@
import bzrlib
from bzrlib import (
bzrdir,
+ debug,
errors,
osutils,
tests,
@@ -3474,6 +3475,18 @@
],
vendor.calls)
+ def test__send_disabled_retry(self):
+ debug.debug_flags.add('noretry')
+ output, vendor, smart_client = self.make_client_with_failing_medium()
+ smart_request = client._SmartClientRequest(smart_client, 'hello', ())
+ self.assertRaises(errors.ConnectionReset, smart_request._send, 3)
+ self.assertEqual(
+ [('connect_ssh', 'a user', 'a pass', 'a host', 'a port',
+ ['bzr', 'serve', '--inet', '--directory=/', '--allow-writes']),
+ ('close',),
+ ],
+ vendor.calls)
+
class LengthPrefixedBodyDecoder(tests.TestCase):
More information about the bazaar-commits
mailing list