deleteQueueItem example

if ($this->updateProcessor->processFetchTask($item->data)) {
          $context['results']['updated']++;
          $context['message'] = $this->t('Checked available update data for %title.', ['%title' => $item->data['info']['name']]);
        }
        else {
          $context['message'] = $this->t('Failed to check available update data for %title.', ['%title' => $item->data['info']['name']]);
          $context['results']['failures']++;
        }
        $context['sandbox']['progress']++;
        $context['results']['processed']++;
        $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
        $this->updateProcessor->deleteQueueItem($item);
      }
      else {
        // If the queue is currently empty, we're done. It's possible that         // another thread might have added new fetch tasks while we were         // processing this batch. In that case, the usual 'finished' math could         // get confused, since we'd end up processing more tasks that we thought         // we had when we started and initialized 'max' with numberOfItems(). By         // forcing 'finished' to be exactly 1 here, we ensure that batch         // processing is terminated.         $context['finished'] = 1;
        return;
      }
Home | Imprint | This part of the site doesn't use cookies.