X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/16942303133cb4e6be76d4d33a211d1e0ce2ea38..6058f336a4562b6d6780c4fcfc4d28b6b2a51948:/sdk/python/arvados/keep.py diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py index e331621cd9..38f332b38e 100644 --- a/sdk/python/arvados/keep.py +++ b/sdk/python/arvados/keep.py @@ -296,14 +296,14 @@ class KeepClient(object): def _get_user_agent(self): try: - return self._user_agent_pool.get(False) + return self._user_agent_pool.get(block=False) except Queue.Empty: return pycurl.Curl() def _put_user_agent(self, ua): try: ua.reset() - self._user_agent_pool.put(ua, False) + self._user_agent_pool.put(ua, block=False) except: ua.close() @@ -527,6 +527,13 @@ class KeepClient(object): with self.pending_tries_notification: while True: if self.pending_copies() < 1: + # This notify_all() is unnecessary -- + # write_success() already called notify_all() + # when pending<1 became true, so it's not + # possible for any other thread to be in + # wait() now -- but it's cheap insurance + # against deadlock so we do it anyway: + self.pending_tries_notification.notify_all() # Drain the queue and then raise Queue.Empty while True: self.get_nowait()