Skip to content

Instantly share code, notes, and snippets.

@clayg
Last active March 24, 2016 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/29eb57bb93142dbfe64b to your computer and use it in GitHub Desktop.
Save clayg/29eb57bb93142dbfe64b to your computer and use it in GitHub Desktop.
diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py
index 3bebd7f..d9e58ab 100644
--- a/swift/proxy/controllers/base.py
+++ b/swift/proxy/controllers/base.py
@@ -959,6 +959,13 @@ class ResumingGetter(object):
# Close-out the connection as best as possible.
if getattr(source[0], 'swift_conn', None):
close_swift_conn(source[0])
+ # Clear anything still in the backend buffers
+ while True:
+ try:
+ next(parts_iter[0])
+ except Exception:
+ self.app.logger.exception("that didn't work")
+ break
diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py
index 69d071a..b849e10 100644
--- a/test/unit/proxy/test_server.py
+++ b/test/unit/proxy/test_server.py
@@ -5827,6 +5827,8 @@ class TestObjectController(unittest.TestCase):
exp = 'HTTP/1.1 201'
self.assertEqual(headers[:len(exp)], exp)
+ _orig_timeout, _test_servers[0].client_timeout = (
+ _test_servers[0].client_timeout, 5)
# get object
fd.write('GET /v1/a/ec-discon/test HTTP/1.1\r\n'
'Host: localhost\r\n'
@@ -5850,6 +5852,7 @@ class TestObjectController(unittest.TestCase):
self.assertEqual(
_test_servers[0].logger.get_lines_for_level('warning'),
expected)
+ _test_servers[0].client_timeout = _orig_timeout
@unpatch_policies
def test_ec_client_put_disconnect(self):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment