def worker(self, message): # indicate receipt of the task self._queue.task_done() try: command = registry.get_command_for_message(message) command.execute() except QueueException: # log error self.logger.warn("queue exception raised", exc_info=1) except: # log the error and raise, killing the worker self.logger.error("unhandled exception in worker thread", exc_info=1) finally: self._pool.release()
def worker(self, message): # indicate receipt of the task self._queue.task_done() try: command = registry.get_command_for_message(message) command.execute() except QueueException: # log error self.logger.warn('queue exception raised', exc_info=1) except: # log the error and raise, killing the worker self.logger.error('unhandled exception in worker thread', exc_info=1) finally: self._pool.release()
def _queue_worker(self): """ A worker thread that will chew on dequeued messages """ while 1: message = self._queue.get() self._queue.task_done() try: command = registry.get_command_for_message(message) command.execute() except QueueException: # log error self.logger.warn('queue exception raised', exc_info=1) except: self.logger.error('exception encountered, exiting thread', exc_info=1) self._error.set()
def _queue_worker(self): """ A worker thread that will chew on dequeued messages """ while 1: message = self._queue.get() self._queue.task_done() try: command = registry.get_command_for_message(message) command.execute() except QueueException: # log error self.logger.warn('queue exception raised', exc_info=1) except: # put the thread's id into the queue of errors for removal current = threading.current_thread() self._errors.put(current.ident) # log the error and raise, killing the worker thread self.logger.error('exception encountered, exiting thread %s' % current, exc_info=1) raise