Only retry on unhealthy exceptions, not JobException's.
This commit is contained in:
parent
0085041517
commit
b9e9064af2
1 changed files with 4 additions and 4 deletions
|
@ -131,12 +131,12 @@ class Worker(object):
|
||||||
|
|
||||||
except JobException:
|
except JobException:
|
||||||
logger.warning('An error occurred processing request: %s', current_queue_item.body)
|
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:
|
except WorkerUnhealthyException:
|
||||||
logger.error('The worker has encountered an error and will not take new jobs. Job is being requeued.')
|
logger.error('The worker has encountered an error and will not take new jobs. Job is being requeued.')
|
||||||
self._stop.set()
|
self._stop.set()
|
||||||
self.mark_current_incomplete()
|
self.mark_current_incomplete(restore_retry=True)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Close the db handle periodically
|
# Close the db handle periodically
|
||||||
|
@ -187,10 +187,10 @@ class Worker(object):
|
||||||
while start_status_server_port is not None:
|
while start_status_server_port is not None:
|
||||||
sleep(60)
|
sleep(60)
|
||||||
|
|
||||||
def mark_current_incomplete(self):
|
def mark_current_incomplete(self, restore_retry=False):
|
||||||
with self._current_item_lock:
|
with self._current_item_lock:
|
||||||
if self.current_queue_item is not None:
|
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
|
self.current_queue_item = None
|
||||||
|
|
||||||
def mark_current_complete(self):
|
def mark_current_complete(self):
|
||||||
|
|
Reference in a new issue