Fixed Unable to resume search index rebuild if it stops

Jake B.

Well-known member
Affected version
2.1.7
I've started a search index rebuild via CLI but it ended up stopping, I don't think there is a way I can resume it without restarting which doesn't seem great since it had been running for around 8 hours before it had stopped. The job is still listed in xf_job but, as far as I can tell, it isn't possible to resume this
 
For now you'd have to go back to the Admin control panel and go to admin.php?tools/run-jobs or it may appear as a manual job outstanding notice on the admin index.

It does mean running it in the browser rather than the CLI but maybe if it has been running for 8 hours it isn't too far from the end?
 
Sadly looks like it still has about 14 million posts to go. Is there a way to programmatically resume the job that I could toss into a new CLI command to get that running in the background?
 
Something like this probably:

PHP:
$maxRunTime = $app->config('jobMaxRunTime');

do
{
   $jobManager->runQueue(true, $maxRunTime);

   // keep the memory limit down on long running jobs
   $app->em()->clearEntityCache();

   $more = $jobManager->queuePending(true);
   if (!$more)
   {
      break;
   }
}
while (true);
That should keep running any outstanding manual jobs until completion.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.10).

Change log:
Allow manually triggered rebuild jobs to be resumed via the command line.
There may be a delay before changes are rolled out to the XenForo Community.
 
To just clarify, the rebuild commands now support --resume and it will resume the existing job (if it exists; it'll error otherwise).
 
Back
Top Bottom