-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Description
The current implementation of waitForAllTasks() in tests/BaseKernelTestCase.php iterates over all tasks returned by getTasks(), including completed historical tasks. This can lead to unnecessary iterations in test environments with large task queues.
Current Implementation
protected function waitForAllTasks(): void
{
foreach ($this->client->getTasks() as $task) {
$this->client->waitForTask($task['uid']);
}
}Proposed Solution
Use the TasksQuery class from meilisearch-php to filter only tasks with enqueued or processing statuses:
use Meilisearch\Contracts\TasksQuery;
protected function waitForAllTasks(): void
{
$query = (new TasksQuery())->setStatuses(['enqueued', 'processing']);
foreach ($this->client->getTasks($query) as $task) {
$this->client->waitForTask($task['uid']);
}
}This approach:
- Reduces iteration over completed tasks
- Improves performance in test environments with large task histories
- Uses the official meilisearch-php TasksQuery API
References
- PR: Add Data providers extension point #410
- Discussion: Add Data providers extension point #410 (comment)
- Requested by: @norkunas
Metadata
Metadata
Assignees
Labels
No labels