mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-24 04:07:30 +01:00
improve the index-scheduler tests
This commit is contained in:
parent
a256021f3e
commit
0b26517b55
@ -239,16 +239,22 @@ impl IndexSchedulerHandle {
|
|||||||
drop(index_scheduler);
|
drop(index_scheduler);
|
||||||
let Self { _tempdir: tempdir, index_scheduler, test_breakpoint_rcv, last_breakpoint: _ } =
|
let Self { _tempdir: tempdir, index_scheduler, test_breakpoint_rcv, last_breakpoint: _ } =
|
||||||
self;
|
self;
|
||||||
|
let env = index_scheduler.env.clone();
|
||||||
drop(index_scheduler);
|
drop(index_scheduler);
|
||||||
|
|
||||||
// We must ensure that the `run` function has stopped running before restarting the index scheduler
|
// We must ensure that the `run` function has stopped running before restarting the index scheduler
|
||||||
loop {
|
loop {
|
||||||
match test_breakpoint_rcv.recv_timeout(Duration::from_secs(5)) {
|
match test_breakpoint_rcv.recv_timeout(Duration::from_secs(5)) {
|
||||||
Ok(_) => continue,
|
Ok((_, true)) => continue,
|
||||||
|
Ok((b, false)) => {
|
||||||
|
panic!("Scheduler is not stopped and passed {b:?}")
|
||||||
|
}
|
||||||
Err(RecvTimeoutError::Timeout) => panic!("The indexing loop is stuck somewhere"),
|
Err(RecvTimeoutError::Timeout) => panic!("The indexing loop is stuck somewhere"),
|
||||||
Err(RecvTimeoutError::Disconnected) => break,
|
Err(RecvTimeoutError::Disconnected) => break,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let closed = env.prepare_for_closing().wait_timeout(Duration::from_secs(5));
|
||||||
|
assert!(closed, "The index scheduler couldn't close itself, it seems like someone else is holding the env somewhere");
|
||||||
|
|
||||||
let (scheduler, mut handle) =
|
let (scheduler, mut handle) =
|
||||||
IndexScheduler::test_with_custom_config(planned_failures, |config| {
|
IndexScheduler::test_with_custom_config(planned_failures, |config| {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user