Bulk deletion of elements via Craft CMS interface via queue to avoid performance limitations #18460
Unanswered
jamesmacwhite
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In Craft CMS it is possible to bulk delete elements using the general interface by selecting multiple elements in a section/channel or similar and using the delete option.
This however, has limitations when deleting a large number of elements in a single request. Usually, this will lead to timeouts due to maximum execution time or similar factors. In the case of Craft Cloud web requests can only be for a maximum of 28 seconds, so deleting a large amount of elements will likely yield "Gateway timeout", because the delete option uses web requests in this case.
The elements that were able to be deleted before reaching the maximum timeout are still deleted, but the experience looks like the command failed entirely.
It potentially highlighted that either in addition to or if the number of elements is greater than a certain number, the queue could be used to offload the longer running deletion to prevent issues.
Currently, there are the following CLI commands:
These however still have limitations on criteria/segmenting a specific set of elements required e.g. by field value, section etc (if dealing with entries). The alternative would be something like a content migration which calls a queue job with whatever criteria required, which would require a code deployment.
Just an observation, there might be enhancements related to bulk deleting that could be part of Craft CMS in the future.
Beta Was this translation helpful? Give feedback.
All reactions