Fixed Unable to resume search index rebuild if it stops

Affected version
2.1.7

Jake B.

Well-known member
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
 

Chris D

XenForo developer
Staff member
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?
 

Jake B.

Well-known member
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?
 

Chris D

XenForo developer
Staff member
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.
 

XF Bug Bot

XenForo bug fixer bot
Staff member
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.
 

Mike

XenForo developer
Staff member
To just clarify, the rebuild commands now support --resume and it will resume the existing job (if it exists; it'll error otherwise).
 
Top