Merge pull request #5565 from meilisearch/fix-0-batched-task

Fix 0 batched task
This commit is contained in:
Tamo 2025-05-15 12:41:48 +00:00 committed by GitHub
commit cc2011a27f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 153 additions and 0 deletions

View file

@ -119,6 +119,9 @@ impl IndexScheduler {
(versioning::VERSION_MAJOR, versioning::VERSION_MINOR, versioning::VERSION_PATCH)
});
// If the number of batched tasks is 0, the scheduler will not run and we can't do the init check.
let skip_init = options.max_number_of_batched_tasks == 0;
std::fs::create_dir_all(&options.auth_path).unwrap();
let auth_env = open_auth_store_env(&options.auth_path).unwrap();
let index_scheduler =
@ -127,7 +130,11 @@ impl IndexScheduler {
// To be 100% consistent between all test we're going to start the scheduler right now
// and ensure it's in the expected starting state.
let breakpoint = match receiver.recv_timeout(std::time::Duration::from_secs(10)) {
Ok(b) if skip_init => {
panic!("The scheduler was not supposed to start, but it did: {b:?}.")
}
Ok(b) => b,
Err(_) if skip_init => (Init, false),
Err(RecvTimeoutError::Timeout) => {
panic!("The scheduler seems to be waiting for a new task while your test is waiting for a breakpoint.")
}