Skip to content

Commit

Permalink
VACMS-14683: Moves sleep function to make it function.
Browse files Browse the repository at this point in the history
  • Loading branch information
omahane committed May 2, 2024
1 parent 5616f3c commit 5914634
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ class ServiceLocationMigration {
*/
protected $serviceLocation;

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

/**
* Constructor for ServiceLocationMigration.
*/
Expand All @@ -47,9 +40,6 @@ public function __construct() {
* Sandbox variable for keeping state during batches.
*/
public function run(array &$sandbox) {
if (($this->runCount > 1) && ($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 @@ -99,8 +89,6 @@ public function run(array &$sandbox) {

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

$this->runCount++;

return $status_msg;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function va_gov_vamc_deploy_migrate_service_data_to_service_location(&$sandbox)
script_library_sandbox_init($sandbox, 'get_nids_of_type', [$source_bundle, FALSE]);
$migrator = new ServiceLocationMigration();
$msg = $migrator->run($sandbox);
if ($sandbox['current'] > 1 && $sandbox['current'] % 1000 === 0) {
sleep(150);
}
$new_service_locations = $sandbox['service_locations_created_count'] ?? 0;
$updated_service_locations = $sandbox['service_locations_updated_count'] ?? 0;
$forward_revisions = $sandbox['forward_revisions_count'] ?? 0;
Expand Down

0 comments on commit 5914634

Please sign in to comment.