Magento index queue not running

We have the latest version of the Magento Algolia extension (1.13.0) installed on our Magento 1.9.3.4 (fully patched) store.

We have a CRON job setup as per your instructions:

EMPTY_QUEUE=1 php -f /absolute/path/to/magento/shell/indexer.php -- -reindex algolia_queue_runner

Where the absolute path is amended to our indexer.php file location.

All other CRON jobs on the Magento store are running as expected but the Algolia queue just keeps growing and never runs.

I’ve tried these steps, which didn’t work. I then truncated the algoliasearch_queue table in the database and then re-built the indexes. This worked however the cron still isn’t running and the jobs keep on building back up. Obviously it’s not good to have to run this manually.

Hello @desresdesign,

when using EMPTY_QUEUE=1 in the command, the queue runner will always take all jobs and will try to process it. It might be too resource demanding that the queue runner might fail.

Can you truncate the queue, rebuild Algolia indexers and then run manually command:

php -f /absolute/path/to/magento/shell/indexer.php -- -reindex algolia_queue_runner

Be default it will take first 10 jobs from the queue and process it.

If it finishes successfully, can you remove EMPTY_QUEUE=1 from your cron command? Then it will process 10 jobs every 5 minutes (be default).

Hi Jan

Thanks for the response. I’ve ran that successfully and I’m just waiting now to see if it continues working via the cron. I’ll keep you posted.

Many thanks
Steve

1 Like

Hi @jan.petr

I’ve left this for a few days now after completing the above but the queue is simply just filling back up again and not processing. All other cron jobs are running as expected.

Many thanks
Steve

@desresdesign, when you run the queue runner command manually, what is the output?

Hi @jan.petr

The response from the manual command, ran via the terminal, is:

Algolia Search Queue Runner index was rebuilt successfully in 00:00:15

Thanks
Steve

It means that some jobs are processing.

Can you check how many rows is in algoliasearch_queue table, run the command manually and check it again? With default queue settings, the queue runner processes 10 jobs in each run. So the number of jobs should be lower by 10.

Let me know if it works for you.

There are only 2 jobs queued up and when I run the command the list empties, as expected, to zero rows.

It looks like the indexer is working correctly so could it be related to the cron? I’m not sure why the other crons would be running and not this, however.

Do you have the exactly same command in the cron?
Can you log the output of the cron to see if it runs correctly?

There was no output in the cron.log file, oddly. This lead me to check how scheduler_cron.sh was running the other jobs and I noticed that it was using the full path for the php command.

So I’ve changed the command from:

php -f /full/path/to/indexer.php -- -reindex algolia_queue_runner

To:

/usr/local/bin/php -f /full/path/to/indexer.php -- -reindex algolia_queue_runner

And it now seems to be running as expected. I’ll monitor it over the next few days but I think that may have solved the issue.

Thanks for your help and advice on this.

1 Like