-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests: Use Server::wait_task() instead of Index::wait_task() #5703
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
base: main
Are you sure you want to change the base?
Conversation
The code is mostly duplicated. Server::wait_task() has better handling for errors and more retries. Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
…r Index:: methods Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Server::<Shared>::_wait_task(async |url| self.service.get(url).await, update_id).await | ||
} | ||
|
||
pub(super) async fn _wait_task<F>(request_fn: F, update_id: u64) -> Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is needed because common::index
needs to use it.
I guess this was the reason for the duplicated method in both files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But doesn't the common::Index contains a Server to make his request against?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Index looks like
meilisearch/crates/meilisearch/tests/common/index.rs
Lines 15 to 20 in bd2bd0f
pub struct Index<'a, State = Owned> { | |
pub uid: String, | |
pub service: &'a Service, | |
pub(super) encoder: Encoder, | |
pub(super) marker: PhantomData<State>, | |
} |
There is no
server
around to be used...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I think we're good, I just have a question as I'm not sure I understood why we're still stuck with this method in the Index (even if the current version is still better as it removes duplicated code)
Server::<Shared>::_wait_task(async |url| self.service.get(url).await, update_id).await | ||
} | ||
|
||
pub(super) async fn _wait_task<F>(request_fn: F, update_id: u64) -> Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But doesn't the common::Index contains a Server to make his request against?
Few Index methods need to wait for tasks. meilisearch/crates/meilisearch/tests/common/index.rs Lines 36 to 50 in bd2bd0f
waits for the test_set JSON[NL] to be fully indexed before returning.
Another option: |
Pull Request
Related issue
#4840
What does this PR do?