I got a system that had trashbin expiry disabled for a long time. When I enabled it in config.php and executed occ files:trashbin:expire manually, I observed it executing really slow. After a while, the cronjob jumped in and started the expiry too, and so the jobs piled up and slowed things down.
We have two issues here::
- apparently, a cron job won’t notice that the previous job hasn’t finished.
- Expiry is slow. I found that a query “Select … from oc_filecache where storage=$1 and name ILIKE $2” is executed. The resulting query plan is a full table scan, which seems to be executed for every file to purge. The ILIKE operator prevents a more selective query plan.
I’d like to investigate the second issue further, can someone point me to where the expiry code and this query is located?