diff options
| author | Samuel Merritt <sam@swiftstack.com> | 2012-06-11 11:39:18 -0700 |
|---|---|---|
| committer | Samuel Merritt <sam@swiftstack.com> | 2012-06-18 09:47:33 -0700 |
| commit | 6c1813dd34c858cf79e4ebab830b7cbe977792f2 (patch) | |
| tree | d5ad51dad0a48ef101964285a9db133fd93a0cf3 /bin | |
| parent | a92a0fa0e43a6f27c66396e0352da8da368067f1 (diff) | |
| download | python-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-x | bin/swift | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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] ... |
