src/Pipelines/Stages/ReIndexStage.php
protected function renderProgressBar(array $task): void
    {
        // Use a progress bar to indicate how far a long the re-indexing has come
        $progressBar = null;

        do {
            $response = ['completed' => false];

            // Ignore ServerErrorResponseException, re-indexing can make these requests time out
            try {
                $response = $this->elasticsearchService->tasks()->get([
                    'task_id' => $task['task'],
                ]);

                $total = $response['task']['status']['total'];

                // Initialize the progress bar once Elasticsearch knows the total amount of items
                if ($progressBar === null && $total > 0) {
                    $progressBar = new ProgressBar(new ConsoleOutput(), $total);
                } elseif ($progressBar !== null) {
                    $progressBar->setProgress($response['task']['status']['created']);
                }
            } catch (ServerErrorResponseException $e) {
            }

            sleep(1);
        } while ((bool)$response['completed'] === false);

        // For very short migrations we may never get a progress bar, because the task finishes too quickly
        if ($progressBar !== null) {
            $progressBar->finish();
        }

        echo PHP_EOL;
    }
protected function renderProgressBar(array $task): void
    {
        // Use a progress bar to indicate how far a long the re-indexing has come
        $progressBar = null;

        do {
            $response = ['completed' => false];

            // Ignore ServerErrorResponseException, re-indexing can make these requests time out
            try {
                $response = $this->elasticsearchService->tasks()->get([
                    'task_id' => $task['task'],
                ]);

                $total = $response['task']['status']['total'];

                // Initialize the progress bar once Elasticsearch knows the total amount of items
                if ($progressBar === null && $total > 0) {
                    $progressBar = new ProgressBar(new ConsoleOutput(), $total);
                } elseif ($progressBar !== null) {
                    $progressBar->setProgress($response['task']['status']['created']);
                }
            } catch (ServerErrorResponseException $e) {
            }

            sleep(1);
        } while ((bool)$response['completed'] === false);

        // For very short migrations we may never get a progress bar, because the task finishes too quickly
        if ($progressBar !== null) {
            $progressBar->finish();
        }

        echo PHP_EOL;
    }
protected function renderProgressBar ( array $ task ) : void { // Use a progress bar to indicate how far a long the re-indexing has come $ progressBar = null ; do { $ response = [ 'completed' => false ] ; // Ignore ServerErrorResponseException, re-indexing can make these requests time out try { $ response = $ this -> elasticsearchService -> tasks ( ) -> get ( [ 'task_id' => $ task [ 'task' ] , ] ) ; $ total = $ response [ 'task' ] [ 'status' ] [ 'total' ] ; // Initialize the progress bar once Elasticsearch knows the total amount of items if ( $ progressBar === null && $ total > 0 ) { $ progressBar = new ProgressBar ( new ConsoleOutput ( ) , $ total ) ; } elseif ( $ progressBar !== null ) { $ progressBar -> setProgress ( $ response [ 'task' ] [ 'status' ] [ 'created' ] ) ; } } catch ( ServerErrorResponseException $ e ) { } sleep ( 1 ) ; } while ( ( bool ) $ response [ 'completed' ] === false ) ; // For very short migrations we may never get a progress bar, because the task finishes too quickly if ( $ progressBar !== null ) { $ progressBar -> finish ( ) ; } echo PHP_EOL ; }
Renders a progress bar until the specified re-indexing task is completed

@param array $task
Renders a progress bar until the specified re - indexing task is completed