Render large image files to disk

This will make little difference to the render process, but saves them to disk once the generation is complete to help clean up memory faster.
stable/4.2.x
Jake Howard 2023-03-10 15:04:44 +00:00 zatwierdzone przez Matt Westcott
rodzic 11549260c8
commit ed51907d72
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -4,7 +4,7 @@ import os.path
import time
from collections import OrderedDict
from contextlib import contextmanager
from io import BytesIO
from tempfile import SpooledTemporaryFile
from typing import Union
import willow
@ -537,7 +537,10 @@ class AbstractImage(ImageFileMixin, CollectionMember, index.Indexed, models.Mode
start_time = time.time()
try:
generated_image = filter.run(self, BytesIO())
generated_image = filter.run(
self,
SpooledTemporaryFile(max_size=settings.FILE_UPLOAD_MAX_MEMORY_SIZE),
)
logger.debug(
"Generated '%s' rendition for image %d in %.1fms",