Skip to content
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

Expose functions to wait for tasks #260

Closed
ahmednfwela opened this issue Mar 4, 2023 · 4 comments
Closed

Expose functions to wait for tasks #260

ahmednfwela opened this issue Mar 4, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@ahmednfwela
Copy link
Collaborator

The functions defined in
https://github.com/meilisearch/meilisearch-dart/blob/main/test/utils/wait_for.dart

should be exposed in the main library, in addition to waitForTasks

@brunoocasali
Copy link
Member

Hi @ahmednfwela, there has been a long long long discussion about this subject, and I don't want to move this function to the public yet.
But, tell me, what is your use case to need those functions?

@ahmednfwela
Copy link
Collaborator Author

Well the main problem is that the server completes the request instantly instead of the expected behavior of waiting until completion.
So imagine a user deleting an Item from a table then doing a refresh, since the request would complete instantly, the refresh will happen and the user will still see the deleted item in the search request since it didn't get deleted yet.

This can be solved by using waitFor polling mechanism, or websockets to inform the client of task completions.

@brunoocasali
Copy link
Member

Indeed that's the current behavior, and the problem is the user can be locked until Meilisearch finally processes the task. This is my main concern with the whole waitForTask thing.
If the current instance is processing a lot of tasks, in the end, the user will have to wait for all the tasks in the queue to be finished to process their task finally.
The queue is shared between every index, and a dump task is prioritized.

In any case, all the other SDKs have this method publically, so I'm open to publicizing these methods for the Dart SDK if more users explicitly let us know their needs (a 👍 in the issue can work).

@brunoocasali brunoocasali added breaking-change The related changes are breaking for the users enhancement New feature or request and removed breaking-change The related changes are breaking for the users labels Mar 6, 2023
@brunoocasali
Copy link
Member

I'll close this issue since this subject could be discussed more broadly in the integration-guides here meilisearch/integration-guides#243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants