Unlimited cron run with PHP CLI causes high memory usage and overlapping crons

Created on 28 May 2025, 10 days ago

Problem/Motivation

When running "drush cron" then there is no limit on how many saved searches will be checked. This is very bad when you migrate hundreds of thousands of job alerts that all want to be checked at the same time.

Symptoms:
* error message: Attempting to run cron while it is already running
* Gigabytes of RAM usage by the PHP process on the server
* Cron never finishes because search_api_saved_searches_cron() tries to process 70k saved searches.

Steps to reproduce

Migrate thousands of saved searches that want to be checked and try to run cron.

Proposed resolution

Always apply the cron_batch_size limit, even when running through the PHP CLI. This ensures cron runs are predictable and don't exhaust server resources.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇹Austria klausi 🇦🇹 Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024