thumbnail: Disable libvips cache.

The libvips cache is 100MB, 100 operations, or 100 files, whichever is
less.  A single Django process or worker is extremely unlikely to ever
see the same image twice, much less within those timeframes.

Disable the cache, since it is mostly useless memory usage for our use
case.
This commit is contained in:
Alex Vandiver
2024-07-22 16:11:13 +00:00
committed by Tim Abbott
parent 1e42d60850
commit 3ac14632d8

View File

@@ -132,6 +132,10 @@ pyvips.operation_block_set("VipsForeignLoadTiff", False) # image/tiff
pyvips.operation_block_set("VipsForeignLoadWebp", False) # image/webp
pyvips.block_untrusted_set(True)
# Disable the operations cache; our only use here is thumbnail_buffer,
# which does not make use of it.
pyvips.voperation.cache_set_max(0)
class BadImageError(JsonableError):
code = ErrorCode.BAD_IMAGE