cms
cms copied to clipboard
[3.x]: Resaving an asset with queue fails to set field data but works when run directly.
What happened?
Description
I want to resave a bunch of assets to populate a new field called alt added to several image asset volumes.
In order to do this I performed an asset element query in a content migration to obtain the required element IDs and then pass these to the ./craft resave/assets command with some additional paramaters.
When testing locally, I've tested these commands, in this case I've just used a single asset ID.
This doesn't seem to work (it runs successfully but the title is not copied to the alt field
/app $ ./craft resave/assets --element-id=602522 --queue=true --set=alt --to=title --update-search-index=true
Assets queued to be resaved.
This does work when the command is not queued
/app $ ./craft resave/assets --element-id=602522 --set=alt --to=title --update-search-index=true
Resaving 1 asset ...
- [1/1] Resaving Graham basten (602522) ... done
Done resaving asset.
When having queue set to true the field data on alt is not set, when running directly without the queue set to true the field data is set accordingly.
The queue job successfully completes and returns no error, but the data is not set.
Steps to reproduce
- Run craft resave/assets using the properties
settoandqueue - The field data specified in to is not written to the field defined on the set value but it is if you omit
queue
Expected behavior
The data to be saved when run as a queue job
Actual behavior
The data does not get written to the defined field when queued.
Craft CMS version
3.7.55
PHP version
8.0
Operating system and version
Ubuntu 20.04 LTS (WSL2)
Database type and version
MySQL 8
Just to add, I've also updated to 3.7.55 as I realised I was slightly out of date, the behaviour remains the same.
Thanks for reporting that! This is now fixed for the next Craft 3 and 4 releases, via #11975.
Craft 3.7.56 and 4.2.6 are out with the fix for this.
Awesome, thank you.
Confirmed, the queue job now supports these parameters and works, with passing set, to and touch.