Skip to content

Commit

Permalink
Fix issue where scale generation failed, because scale task was proce…
Browse files Browse the repository at this point in the history
…ssed before placeholder was available
  • Loading branch information
datakurre committed Apr 24, 2020
1 parent 971aee3 commit 4d1a154
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plone/namedfile/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def put(self, storage_oid, data_oid, filename, klass, context, **parameters):
self._retries[task] = 0
self._queue.put(task)

def _retry_task(self, task, exception):
"""Retry task because of exception"""
def _retry_task(self, task, reason):
"""Retry task because of exception or other reason"""
assert isinstance(task, tuple)
error = False
with self._retries_lock:
Expand All @@ -151,8 +151,10 @@ def _retry_task(self, task, exception):
error = True
else:
self._retry.put(task)
if error:
logger.exception(str(exception))
if error and isinstance(reason, Exception):
logger.exception(str(reason))
elif error:
logger.warning(str(reason))

def run(self, forever=True):
atexit.register(self.stop)
Expand Down Expand Up @@ -240,7 +242,8 @@ def _queue_scale_execution(self, task):
future = self._executor.submit(scaleImageTask, path, **parameters)
return future

logger.warning("Skipped scale without matching key: " + str(task))
self._retry_task(
task, "Skipped scale without matching key: " + str(task))
return None

def _store_scale_result(self, task, result, t):
Expand Down

0 comments on commit 4d1a154

Please sign in to comment.