kopia lustrzana https://github.com/wagtail/wagtail
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
rodzic
f82ff1e22c
commit
ab92331f99
|
@ -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",
|
||||
|
|
Ładowanie…
Reference in New Issue