summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSamuel Merritt <sam@swiftstack.com>2012-06-11 11:39:18 -0700
committerSamuel Merritt <sam@swiftstack.com>2012-06-18 09:47:33 -0700
commit6c1813dd34c858cf79e4ebab830b7cbe977792f2 (patch)
treed5ad51dad0a48ef101964285a9db133fd93a0cf3 /bin
parenta92a0fa0e43a6f27c66396e0352da8da368067f1 (diff)
downloadpython-swiftclient-6c1813dd34c858cf79e4ebab830b7cbe977792f2.tar.gz
Make swift not hang on error.
Before, if a QueueFunctionThread's function raised an exception, then its thread would log the exception and exit, leaving the rest of the jobs in the queue and ensuring that the swift client would hang. Now, the exception is logged and processing continues, so all the messages get handled eventually and the client exits. Change-Id: I43d4df212847a2a85732b304de319ea2cce82ddd
Diffstat (limited to 'bin')
-rwxr-xr-xbin/swift21
1 files changed, 11 insertions, 10 deletions
diff --git a/bin/swift b/bin/swift
index 354f82c..aecdbb5 100755
--- a/bin/swift
+++ b/bin/swift
@@ -83,20 +83,21 @@ class QueueFunctionThread(Thread):
self.exc_infos = []
def run(self):
- try:
- while True:
+ while True:
+ try:
+ item = self.queue.get_nowait()
+ except Empty:
+ if self.abort:
+ break
+ sleep(0.01)
+ else:
try:
- item = self.queue.get_nowait()
if not self.abort:
self.func(item, *self.args, **self.kwargs)
+ except Exception:
+ self.exc_infos.append(exc_info())
+ finally:
self.queue.task_done()
- except Empty:
- if self.abort:
- break
- sleep(0.01)
- except Exception:
- self.exc_infos.append(exc_info())
-
st_delete_help = '''
delete --all OR delete container [--leave-segments] [object] [object] ...