From c06b99f412ea1b7692aea88737ea7aab3dc5f94b Mon Sep 17 00:00:00 2001 From: Christian Burk Date: Thu, 2 May 2024 09:17:12 -0500 Subject: [PATCH] VACMS-14683: Adds sleep after 1000 --- .../va_gov_vamc/src/ServiceLocationMigration.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; }