1

We have about 700 images, with only a few transformations possible (about 10).

For some reason, the queue for "Image transformation" keeps getting bigger, and even once it gets all processed (it takes time,but that's another issue), some keeps getting added to the list. It just never really stops, even without adding new images.

It could be something I don't understand about image transformation but once they are generated, why would they get generated again and again ?

Thank you !

1 Answer 1

2

It depends on a couple of factors:

  • Are you using a local filesystem or external filesystem (like S3)?
  • Is the asset transform index cleared on a regular basis (for example, by running clear-caches/all during deployments)?
  • Are you on Craft CMS < 4.4.7?

Clearing the asset transform index means Craft loses all knowledge of which transforms exist in the filesystem, so it will have to check and update the index for every one of them. On Craft < 4.4.7, after clearing the index, all requested transforms will result in a new queue job. This queue job will see that the file already exists on disk and just recreate the corresponding row in the index. However, this will still cause a ton of queue jobs to show up after every deployment / cache clearing. This was changed in Craft 4.4.7:

The image transformer now verifies that transforms don’t exist if the index record is missing, before queuing up the transform generation, for local filesystems. (#13052)

If the file already exists on disk, the index will be updated on the fly, without an additional queue job. However, this only applies to local filesystems – external filesystems will still require a queue job for every requested transform, every time the asset transform index is cleared.

So if you're using Craft < 4.4.7, update to the latest version to reduce the number of queue jobs you're seeing. If you're using external file systems, consider keeping only the transforms on a local filesystem so Craft can verify them immediately.

2
  • 1
    We are indeed using S3, to have a better availability, so I don't think we would move it local storage. At least now I understand why ! Thank you !
    – Ebpo
    Commented Jun 14, 2023 at 12:56
  • @Ebpo You could try to avoid clearing the asset transform index cache regularly – for example, by leaving that out of a deployment. Of course, that can potentially cause some problems …
    – MoritzLost
    Commented Jun 14, 2023 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.