Skip to content

Apply task changes #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Command/MeiliSearchCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$task = $indexInstance->{$method}($value);

$indexInstance->waitForTask($task['uid']);
$task = $indexInstance->getTask($task['uid']);
$indexInstance->waitForTask($task['taskUid']);
$task = $indexInstance->getTask($task['taskUid']);

if ('failed' === $task['status']) {
throw new TaskException($task['error']);
Expand Down
8 changes: 4 additions & 4 deletions src/Command/MeiliSearchImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$task = $indexInstance->{$method}($value);

// Get task information using uid
$indexInstance->waitForTask($task['uid'], $responseTimeout);
$task = $indexInstance->getTask($task['uid']);
$indexInstance->waitForTask($task['taskUid'], $responseTimeout);
$task = $indexInstance->getTask($task['taskUid']);

if ('failed' === $task['status']) {
throw new TaskException($task['error']);
Expand Down Expand Up @@ -175,8 +175,8 @@ private function formatIndexingResponse(array $batch, int $responseTimeout): arr
$indexInstance = $this->searchClient->index($indexName);

// Get task information using uid
$indexInstance->waitForTask($apiResponse['uid'], $responseTimeout);
$task = $indexInstance->getTask($apiResponse['uid']);
$indexInstance->waitForTask($apiResponse['taskUid'], $responseTimeout);
$task = $indexInstance->getTask($apiResponse['taskUid']);

if ('failed' === $task['status']) {
throw new TaskException($task['error']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function testPreRemoveWithObjectId(): void
*/
private function waitForAllTasks(): void
{
$firstTask = $this->client->getTasks()['results'][0];
$firstTask = $this->client->getTasks()->getResults()[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the new return type of getTasks, it was an array before, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@brunoocasali brunoocasali Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intrinsically is the same behavior but the correct way to access this value is through the getter :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! thanks!

$this->client->waitForTask($firstTask['uid']);
}
}