diff --git a/docroot/modules/custom/va_gov_vamc/src/ServiceLocationMigration.php b/docroot/modules/custom/va_gov_vamc/src/ServiceLocationMigration.php index cc0e300bf3..546c7ca082 100644 --- a/docroot/modules/custom/va_gov_vamc/src/ServiceLocationMigration.php +++ b/docroot/modules/custom/va_gov_vamc/src/ServiceLocationMigration.php @@ -26,6 +26,13 @@ class ServiceLocationMigration { */ protected $serviceLocation; + /** + * Counter of runs. + * + * @var int + */ + protected $runCount = 0; + /** * Constructor for ServiceLocationMigration. */ @@ -40,6 +47,9 @@ public function __construct() { * Sandbox variable for keeping state during batches. */ public function run(array &$sandbox) { + if ($this->runCount % 1000 === 0) { + sleep(120); + } $node_storage = get_node_storage(); $nid_to_load = reset($sandbox['items_to_process']); $facility_service = (empty($nid_to_load)) ? [] : $node_storage->loadMultiple([$nid_to_load]); @@ -89,6 +99,8 @@ public function run(array &$sandbox) { unset($sandbox['items_to_process'][_va_gov_stringifynid($nid)]); + $this->runCount++; + return $status_msg; }