mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-09 23:49:29 -06:00
Fixes handling the case where there is no status reported from celery (due to external termination of the worker) (#12040)
This commit is contained in:
@@ -150,7 +150,15 @@ def run_convert(
|
|||||||
) -> None:
|
) -> None:
|
||||||
environment = os.environ.copy()
|
environment = os.environ.copy()
|
||||||
if settings.CONVERT_MEMORY_LIMIT:
|
if settings.CONVERT_MEMORY_LIMIT:
|
||||||
|
# MAGICK_MEMORY_LIMIT sets the maximum amount of RAM the pixel cache can use.
|
||||||
|
# MAGICK_MAP_LIMIT sets the maximum amount of memory-mapped I/O allowed.
|
||||||
|
#
|
||||||
|
# For large-format documents ImageMagick will hit the RAM limit and
|
||||||
|
# immediately try to "map" the remaining data. If MAGICK_MAP_LIMIT isn't
|
||||||
|
# also set, the process may trigger an OOM kill because the default
|
||||||
|
# system/policy map limit is often too restrictive for these massive bitmaps.
|
||||||
environment["MAGICK_MEMORY_LIMIT"] = settings.CONVERT_MEMORY_LIMIT
|
environment["MAGICK_MEMORY_LIMIT"] = settings.CONVERT_MEMORY_LIMIT
|
||||||
|
environment["MAGICK_MAP_LIMIT"] = settings.CONVERT_MEMORY_LIMIT
|
||||||
if settings.CONVERT_TMPDIR:
|
if settings.CONVERT_TMPDIR:
|
||||||
environment["MAGICK_TMPDIR"] = settings.CONVERT_TMPDIR
|
environment["MAGICK_TMPDIR"] = settings.CONVERT_TMPDIR
|
||||||
|
|
||||||
|
|||||||
@@ -936,7 +936,7 @@ def task_postrun_handler(
|
|||||||
task_instance = PaperlessTask.objects.filter(task_id=task_id).first()
|
task_instance = PaperlessTask.objects.filter(task_id=task_id).first()
|
||||||
|
|
||||||
if task_instance is not None:
|
if task_instance is not None:
|
||||||
task_instance.status = state
|
task_instance.status = state or states.FAILURE
|
||||||
task_instance.result = retval
|
task_instance.result = retval
|
||||||
task_instance.date_done = timezone.now()
|
task_instance.date_done = timezone.now()
|
||||||
task_instance.save()
|
task_instance.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user