diff --git a/workers/worker.py b/workers/worker.py index baade33c0..12bd4d243 100644 --- a/workers/worker.py +++ b/workers/worker.py @@ -131,12 +131,12 @@ class Worker(object): except JobException: logger.warning('An error occurred processing request: %s', current_queue_item.body) - self.mark_current_incomplete() + self.mark_current_incomplete(restore_retry=False) except WorkerUnhealthyException: logger.error('The worker has encountered an error and will not take new jobs. Job is being requeued.') self._stop.set() - self.mark_current_incomplete() + self.mark_current_incomplete(restore_retry=True) finally: # Close the db handle periodically @@ -187,10 +187,10 @@ class Worker(object): while start_status_server_port is not None: sleep(60) - def mark_current_incomplete(self): + def mark_current_incomplete(self, restore_retry=False): with self._current_item_lock: if self.current_queue_item is not None: - self._queue.incomplete(self.current_queue_item, restore_retry=True) + self._queue.incomplete(self.current_queue_item, restore_retry=restore_retry) self.current_queue_item = None def mark_current_complete(self):