-
Notifications
You must be signed in to change notification settings - Fork 14
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
WaitForPendingUpdate method #1
Comments
After discussing with @eskombro, we decided to choose these default values for
|
I'm working on this right now! |
After some research
The JS version will also be called |
I have removed all the sleeps in all the javascript tests and replaced them with
Thanks to this function I'm now sure that the process will be resolved before continuing. No more arbitrary sleeps that are not reliable at all! |
Should be updated for JS as done |
After discussing this implementation with @tpayet , it seems that it is not necessarily the best idea to have 'updateId' as a parameter for the waitForPendingUpdate method. With this method signature, the user needs to:
It would be way easier and logical to receive the "update" json object, and pass it directly to the waitForPendingUpdate
Example: some_documents = [{ "name": "eskombro" }]
update = index.add_documents(some_documents)
wait_for_pending_update(update) or even: some_documents = [{ "name": "eskombro" }]
wait_for_pending_update(index.add_documents(some_documents)) What do you think @bidoubiwa and @curquiza ? |
Yes, that makes sense! It does not make the usage of it confusing and it makes it easier. |
Like that! Another possibility is to return an index.add_documents(some_documents).wait_for_pending_update() In general, it's better to return an object (I mean an instance of a class with attributes and methods) than just a JSON-like as we do now.
But it might involves more implementation 😉 |
@curquiza I really like your idea! But as you say, this implies a lot of refactor for some of the SDK's and seems like a bigger issue. (we can create a new discussion if you want). But we agree in both visions that |
For me, having the |
This method is already implemented everywhere except in the Swift and Rust SDK where issues are opened! Closing this general issue then! |
150: Rewrite client r=alallema a=alallema **Description** Start of SDK go modification: - Rewriting of the Client that implements this method: - Index(uid string) - GetIndex(indexID string) - GetAllIndexes() - CreateIndex(config IndexConfig) - GetOrCreateIndex(config IndexConfig) - GetKeys() - GetAllStats() - CreateDump() - GetDumpStatus(dumpUID string) - Version() - GetVersion() - Health() - IsHealthy() - DeleteIndex(uid string) - Rewriting of the Index that implements this method: - FetchInfo() - FetchPrimaryKey() - ChangePrimaryKey() - Delete() - AddDocuments() - UpdateDocuments() - GetDocument() - GetDocuments() - DeleteOneDocument() - DeletesDocuments() - DeleteAllDocuments() - GetAllUpdateStatus() - GetUpdateStatus() - Search() - GetSettings() - UpdateSettings() - ResetSettings() - GetStats() - WaitForPendingUpdate() - DefaultWaitForPendingUpdate() - Removing of intermediates interfaces - Rewriting of sample and Readme for the new usage - Add tests for every method **To do** - Client - [x] Rewrite Client - [x] Add Test to Client - Index - [x] Rewrite Index - [x] Add Tests to Index - [x] Adding test for `WaitForPendingUpdate()` Issue [related](meilisearch/integration-guides#1) - [x] Rewrite Document - [x] Add Tests to Document - [x] Rewrite Search - [x] Add Tests Search - [x] Rewrite Settings - [x] Add Tests Settings Co-authored-by: alallema <amelie@meilisearch.com>
150: Rewrite client r=alallema a=alallema **Description** Start of SDK go modification: - Rewriting of the Client that implements this method: - Index(uid string) - GetIndex(indexID string) - GetAllIndexes() - CreateIndex(config IndexConfig) - GetOrCreateIndex(config IndexConfig) - GetKeys() - GetAllStats() - CreateDump() - GetDumpStatus(dumpUID string) - Version() - GetVersion() - Health() - IsHealthy() - DeleteIndex(uid string) - Rewriting of the Index that implements this method: - FetchInfo() - FetchPrimaryKey() - ChangePrimaryKey() - Delete() - AddDocuments() - UpdateDocuments() - GetDocument() - GetDocuments() - DeleteOneDocument() - DeletesDocuments() - DeleteAllDocuments() - GetAllUpdateStatus() - GetUpdateStatus() - Search() - GetSettings() - UpdateSettings() - ResetSettings() - GetStats() - WaitForPendingUpdate() - DefaultWaitForPendingUpdate() - Removing of intermediates interfaces - Rewriting of sample and Readme for the new usage - Add tests for every method **To do** - Client - [x] Rewrite Client - [x] Add Test to Client - Index - [x] Rewrite Index - [x] Add Tests to Index - [x] Adding test for `WaitForPendingUpdate()` Issue [related](meilisearch/integration-guides#1) - [x] Rewrite Document - [x] Add Tests to Document - [x] Rewrite Search - [x] Add Tests Search - [x] Rewrite Settings - [x] Add Tests Settings Co-authored-by: alallema <amelie@meilisearch.com>
We want to provide a method in the MeiliSearch SDKs to wait for the asynchronous update.
Really useful in the testing part instead of using
sleep
methods everwhere.Naming
We chose the name
WaitForPendingUpdate
for this method.Except for the JS:
getUpdateSync
because of JS convention.The parameters should be named as
updateId
,interval
andtimeout
.Details of the method
This method must have a break condition.
This method is a loop that checks the status of the update every
interval
until atimeout
.Both parameters must be customizable by the user.
If it's possible with the language, both parameters should be optional and the method should set default values if they are not defined by the user.
If it's not, like in Golang, another function (like a "wrapper") could be provided with default parameters.
If the method times out, it should return a
TimeOut Exception
.Example in PHP
Testing part
At least, we should provide the following tests:
interval
andtimeout
timeout
.Steps
Do it in:
The text was updated successfully, but these errors were encountered: