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.
pull/10307/head
Jake Howard 2023-03-10 15:04:44 +00:00 zatwierdzone przez Matt Westcott
rodzic f82ff1e22c
commit ab92331f99
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
@ -538,7 +538,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",