Skip to content
Snippets Groups Projects
Commit fc63c091 authored by baldwinlouie's avatar baldwinlouie Committed by Yas Naoi
Browse files

Issue #3179717 by baldwinlouie, yas: Fix an error "Route required" while running drush queue-run

parent c541adc2
No related branches found
No related tags found
No related merge requests found
......@@ -3156,21 +3156,39 @@ class Ec2Service extends CloudServiceBase implements Ec2ServiceInterface {
* The batch builder object.
*/
protected function runBatch(BatchBuilder $batch_builder) {
// Log the start time.
$start = $this->getTimestamp();
$batch_array = $batch_builder->toArray();
batch_set($batch_array);
// Reset the progressive so batch works with out a web head.
$batch = &batch_get();
$batch['progressive'] = FALSE;
batch_process();
// Log the end time.
$end = $this->getTimestamp();
$this->logger('ec2_service')->info($this->t('@updater - @cloud_context: Batch operation took @time seconds.', [
'@cloud_context' => $this->cloudContext,
'@updater' => $batch_array['title'],
'@time' => $end - $start,
]));
try {
// Log the start time.
$start = $this->getTimestamp();
$batch_array = $batch_builder->toArray();
batch_set($batch_array);
// Reset the progressive so batch works with out a web head.
$batch = &batch_get();
$batch['progressive'] = FALSE;
// Check if using Drush to process the queue.
// using drush_backend_batch_process() will fix the "Route not found"
// error.
if (PHP_SAPI === 'cli' && function_exists('drush_backend_batch_process')) {
drush_backend_batch_process();
}
else {
batch_process();
}
// Log the end time.
$end = $this->getTimestamp();
$this->logger('ec2_service')->info($this->t('@updater - @cloud_context: Batch operation took @time seconds.', [
'@cloud_context' => $this->cloudContext,
'@updater' => $batch_array['title'],
'@time' => $end - $start,
]));
}
catch (Exception $e) {
$this->handleException($e);
}
finally {
// Reset the batch otherwise this operation hangs when using Drush.
// https://www.drupal.org/project/drupal/issues/3166042
$batch = [];
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment