Skip to content

Commit

Permalink
VACMS-14683: Adds sleep after 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
omahane committed May 2, 2024
1 parent e4e77a8 commit c06b99f
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class ServiceLocationMigration {
*/
protected $serviceLocation;

/**
* Counter of runs.
*
* @var int
*/
protected $runCount = 0;

/**
* Constructor for ServiceLocationMigration.
*/
Expand All @@ -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]);
Expand Down Expand Up @@ -89,6 +99,8 @@ public function run(array &$sandbox) {

unset($sandbox['items_to_process'][_va_gov_stringifynid($nid)]);

$this->runCount++;

return $status_msg;
}

Expand Down

0 comments on commit c06b99f

Please sign in to comment.