Skip to content

Commit

Permalink
Merge pull request #110 from discoverygarden/fix/queue-reference
Browse files Browse the repository at this point in the history
DDST-116: Rearrange queue references.
  • Loading branch information
nchiasson-dgi authored Jun 19, 2024
2 parents 39362bf + 4978bd9 commit 30ac003
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Util/MigrationRollbackBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function enqueue(): int {
new StatusFilter($id_map, StatusFilter::mapStatuses('failed,ignored')) :
$id_map;
foreach ($iterator as $row) {
$this->queue->createItem([
$queue->createItem([
'iterator_value' => $row,
'destination' => $id_map->currentDestination(),
'source' => $id_map->currentSource(),
Expand All @@ -132,16 +132,17 @@ private function enqueue(): int {
public function processBatch(&$context) : void {
$sandbox =& $context['sandbox'];

$queue = $this->getQueue();

if (!isset($sandbox['total'])) {
$sandbox['total'] = $this->queue->numberOfItems();
$sandbox['total'] = $queue->numberOfItems();
if ($sandbox['total'] === 0) {
$context['message'] = $this->t('Queue empty.');
$context['finished'] = 1;
return;
}
}

$queue = $this->getQueue();
$get_current = function (bool $pre_delete = FALSE) use (&$sandbox, $queue) {
return $sandbox['total'] - $queue->numberOfItems() + ($pre_delete ? 1 : 0);
};
Expand Down

0 comments on commit 30ac003

Please sign in to comment.