Somehow it looks like my deployments are breaking as there are pending items to be indexed:
[37;46;1m[notice][39;49;22m Synchronized configuration: update block.block.views_block__search_block_3.
[37;46;1m[notice][39;49;22m Synchronized configuration: update block.block.views_block__search_block_2.
[37;46;1m[notice][39;49;22m Synchronized configuration: update block.block.exposedformsearchpage_2.
[37;46;1m[notice][39;49;22m Synchronized configuration: update acquia_connector.settings.
[37;46;1m[notice][39;49;22m Synchronized configuration: update config_split.config_split.test.
[37;46;1m[notice][39;49;22m Synchronized configuration: update project_events_importer.nextsince.
[37;46;1m[notice][39;49;22m Tracking items for search index <em class="placeholder">Content</em> (1 of 1)
[37;46;1m[notice][39;49;22m Tracking items for search index <em class="placeholder">Content</em> (1 of 1)
[37;46;1m[notice][39;49;22m Tracking items for search index <em class="placeholder">Content</em> (1 of 1)
... and 2,370 items later...
[37;46;1m[notice][39;49;22m Tracking items for search index <em class="placeholder">Content</em> (1 of 1)
[37;46;1m[notice][39;49;22m Tracking items for search index <em class="placeholder">Content</em> (1 of 1)
[37;46;1m[notice][39;49;22m Tracking items for search index <em class="placeholder">Content</em> (1 of 1)
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 24576 bytes) in /mnt/www/html/myproject/docroot/core/lib/Drupal/Core/Database/Statement.php on line 59
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 65536 bytes) in /mnt/www/html/myproject/vendor/drush/drush/src/Boot/DrupalBoot8.php on line 261
[Acquia\Blt\Robo\Tasks\DrushTask] Exit code 255 Time 05:22
[error] Failed to import configuration!
[error] Command `drupal:config:import ` exited with code 1.
According to the Status report, I have over 50k+ pending Search API tasks. I have disabled and re-enabled the index to track items and reindex from scratch but when I do it:
myproject@staging-30580:/var/www/html/myprojectstg$ drush search-api-enable acquia_search_index -vvv
[preflight] Config paths: /etc/drush/drush.yml,/mnt/www/html/myprojectstg/vendor/drush/drush/drush.yml,/mnt/www/html/myprojectstg/drush/drush.yml
[preflight] Alias paths: /mnt/drush/myproject,/mnt/www/html/myprojectstg/docroot/drush/sites,/var/www/html/myprojectstg/drush/sites
[preflight] Commandfile search paths: /mnt/www/html/myprojectstg/vendor/drush/drush/src,/etc/acquiadrush/commands,/mnt/www/html/myprojectstg/drush
[debug] Bootstrap further to find search-api-enable
[debug] Trying to bootstrap as far as we can
[bootstrap] Drush bootstrap phase: bootstrapDrupalRoot()
[bootstrap] Change working directory to /mnt/www/html/myprojectstg/docroot
[bootstrap] Initialized Drupal 8.5.8 root directory at /mnt/www/html/myprojectstg/docroot
[bootstrap] Drush bootstrap phase: bootstrapDrupalSite()
[bootstrap] Initialized Drupal site default at sites/default
[bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration()
[debug] Add service modifier
[info] sql-query: SELECT 1;
[info] Executing: mysql --defaults-file=/mnt/tmp/myprojectstg/drush_mBErIy --database=myprojectstg --host=staging-30580 --port=3306 --silent -A < /mnt/tmp/myprojectstg/drush_6HpmhZ > /dev/null
[info] sql-query: SELECT 1 FROM key_value LIMIT 1;
[info] Executing: mysql --defaults-file=/mnt/tmp/myprojectstg/drush_A0HnEH --database=myprojectstg --host=staging-30580 --port=3306 --silent -A < /mnt/tmp/myprojectstg/drush_EE8ob8 > /dev/null
[bootstrap] Drush bootstrap phase: bootstrapDrupalDatabase()
[bootstrap] Successfully connected to the Drupal database.
[bootstrap] Drush bootstrap phase: bootstrapDrupalFull()
[debug] Start bootstrap of the Drupal Kernel.
[debug] Finished bootstrap of the Drupal Kernel.
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigExportCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigImportCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\BatchCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\CliCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\DrupalCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\EntityCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\ImageCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\LanguageCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\LocaleCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\MessengerCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\QueueCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\RoleCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\StateCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\TwigCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\UserCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\ViewsCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\WatchdogCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\pm\PmCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\pm\ThemeCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands
[debugnotify] Add a commandfile class: Drupal\config_split\Commands\ConfigSplitCommands
[debugnotify] Add a commandfile class: Drupal\devel\Commands\DevelCommands
[debugnotify] Add a commandfile class: Drupal\lightning_core\Commands\Hooks
[debugnotify] Add a commandfile class: Drupal\lightning_core\Commands\LightningCoreCommands
[debugnotify] Add a commandfile class: Drupal\lightning_scheduler\Commands\MigrationCommands
[debugnotify] Add a commandfile class: Drupal\migrate_manifest\Commands\MigrateManifestCommands
[debugnotify] Add a commandfile class: Drupal\migrate_tools\Commands\MigrateToolsCommands
[debugnotify] Add a commandfile class: Drupal\search_api\Commands\SearchApiCommands
[debugnotify] Add a commandfile class: Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands
[debug] Done with bootstrap max in Application::find(): trying to find search-api-enable again.
[bootstrap] Starting bootstrap to none [0.41 sec, 30.93 MB]
[bootstrap] Drush bootstrap phase 0 [0.41 sec, 30.93 MB]
[bootstrap] Try to validate bootstrap phase 0 [0.41 sec, 30.93 MB]
And here the process is stuck and memory and CPU usage starts to increase, causing performance issues.
Does anyone have an insight on how could I process the pending items in batches so it doesn't consume all of my resources? I'm using BLT/Lightning and Acquia Cloud.