Fix exceptions raised by the diffs worker

Fixes #465
This commit is contained in:
Joseph Schorr 2015-09-10 14:12:16 -04:00
parent 15963fe18c
commit 96d5bbb155
2 changed files with 12 additions and 1 deletions

View file

@ -185,7 +185,12 @@ class WorkQueue(object):
def complete(self, completed_item): def complete(self, completed_item):
with self._transaction_factory(db): with self._transaction_factory(db):
completed_item_obj = self._item_by_id_for_update(completed_item.id) try:
completed_item_obj = self._item_by_id_for_update(completed_item.id)
except QueueItem.DoesNotExist:
self._currently_processing = False
return
completed_item_obj.delete_instance(recursive=True) completed_item_obj.delete_instance(recursive=True)
self._currently_processing = False self._currently_processing = False

View file

@ -23,6 +23,12 @@ class DiffsWorker(QueueWorker):
msg = ('Image does not exist in database \'%s\' for repo \'%s/\'%s\'' % msg = ('Image does not exist in database \'%s\' for repo \'%s/\'%s\'' %
(image_id, namespace, repository)) (image_id, namespace, repository))
logger.warning(msg) logger.warning(msg)
except IOError:
# This exception is unrecoverable, and the item should continue and be
# marked as complete.
msg = ("Data could not be retrieved for image %s under repo %s/%s" %
(image_id, namespace, repository))
logger.exception(msg)
return True return True