From d60662b2eb46cdd5d5ec591435d11beafb66ca01 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 30 Jun 2016 14:32:35 -0700 Subject: [PATCH] Only use Timeout if we don't have a final_resp I'm sure the Timeout context manager is relatively cheap, but it can't be free. Change-Id: I71c0c5944ec372e9b983021dd024de0c5aa1ded2 --- swift/proxy/controllers/obj.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swift/proxy/controllers/obj.py b/swift/proxy/controllers/obj.py index 962cf1bec6..54ee996aa7 100644 --- a/swift/proxy/controllers/obj.py +++ b/swift/proxy/controllers/obj.py @@ -1471,15 +1471,15 @@ class Putter(object): :returns: HTTPResponse :raises: Timeout if the response took too long """ - with Timeout(timeout): - # don't do this update of self.resp if the Expect response during - # conenct() was actually a final response - if not self.final_resp: + # don't do this update of self.resp if the Expect response during + # connect() was actually a final response + if not self.final_resp: + with Timeout(timeout): if informational: self.resp = self.conn.getexpect() else: self.resp = self.conn.getresponse() - return self.resp + return self.resp def spawn_sender_greenthread(self, pool, queue_depth, write_timeout, exception_handler):