Problem/Motivation

Enabling an index takes so long that it times out.

Proposed resolution

Use the batch api to handle the behavior that's currently in postSave

Comments

joachim created an issue. See original summary.

Chris Gillis’s picture

I believe it does use a batch. Did it time out for you?

joachim’s picture

IIRC... it didn't on my local, but that's because I've set an insanely high script time limit on my PHP ;)
On the dev server it did time out and I had to use Drush to enable it instead.

borisson_’s picture

Title: enabling an index takes a long time » Enabling an index should use the batch api
Issue summary: View changes

We already have something like that but from your report, it sounds like that doesn't work?

// Give tests and site admins the possibility to disable the use of a
// batch for tracking items. Also, do not use a batch if running in the
// CLI.
$use_batch = \Drupal::state()->get('search_api_use_tracking_batch', TRUE);
if (!$use_batch || php_sapi_name() == 'cli') {
  $index_task_manager->addItemsAll($this);
}
else {
  $index_task_manager->addItemsBatch($this);
}
sharma.amitt16’s picture

It's working is expected. I tested it by enabling and disabling the index. Batch is already there while content needs to be indexed after clicking on Index Content.

I believe no code changes required in this. Also, no activity from the past 4 years, hence mark this issue as closed.

sharma.amitt16’s picture

Status: Active » Closed (cannot reproduce)