[ARVADOS] updated: 4008f2a65be7074f606f1d95e07a670d706a53c9

git at public.curoverse.com git at public.curoverse.com
Wed Apr 29 11:15:14 EDT 2015


Summary of changes:
 sdk/python/arvados/keep.py | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

       via  4008f2a65be7074f606f1d95e07a670d706a53c9 (commit)
      from  cfcefb3de7406b1de3af3765fdb6f8c070bbfa23 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 4008f2a65be7074f606f1d95e07a670d706a53c9
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Apr 29 11:10:40 2015 -0400

    5562: Return UA to pool if it worked well enough to get an HTTP status.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 0383df9..b4f90d9 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -384,13 +384,19 @@ class KeepClient(object):
                 }
                 ok = False
             self._usable = ok != False
+            if self._result.get('status_code', None):
+                # The client worked well enough to get an HTTP status
+                # code, so presumably any problems are just on the
+                # server side and it's OK to reuse the client.
+                self._put_user_agent(curl)
+            else:
+                # Don't return this client to the pool, in case it's
+                # broken.
+                curl.close()
             if not ok:
                 _logger.debug("Request fail: GET %s => %s: %s",
                               url, type(self._result['error']), str(self._result['error']))
-                # Don't return this ua to the pool, in case it's broken.
-                curl.close()
                 return None
-            self._put_user_agent(curl)
             _logger.info("%s response: %s bytes in %s msec (%.3f MiB/sec)",
                          self._result['status_code'],
                          len(self._result['body']),
@@ -443,13 +449,15 @@ class KeepClient(object):
                 }
                 ok = False
             self._usable = ok != False # still usable if ok is True or None
+            if self._result.get('status_code', None):
+                # Client is functional. See comment in get().
+                self._put_user_agent(curl)
+            else:
+                curl.close()
             if not ok:
                 _logger.debug("Request fail: PUT %s => %s: %s",
                               url, type(self._result['error']), str(self._result['error']))
-                # Don't return this ua to the pool, in case it's broken.
-                curl.close()
                 return False
-            self._put_user_agent(curl)
             return True
 
         def _setcurltimeouts(self, curl, timeouts):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list