mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
test: Add a way to setup the fetch timeout of the query-database example
This commit is contained in:
parent
9c5ec110e5
commit
8030a822ab
@ -24,6 +24,9 @@ pub struct Opt {
|
||||
#[structopt(parse(from_os_str))]
|
||||
pub database_path: PathBuf,
|
||||
|
||||
#[structopt(long = "fetch-timeout-ms")]
|
||||
pub fetch_timeout_ms: Option<u64>,
|
||||
|
||||
/// Fields that must be displayed.
|
||||
pub displayed_fields: Vec<String>,
|
||||
|
||||
@ -159,7 +162,13 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
Ok(query) => {
|
||||
let start_total = Instant::now();
|
||||
|
||||
let builder = index.query_builder().with_fetch_timeout(Duration::from_millis(40));
|
||||
let builder = match opt.fetch_timeout_ms {
|
||||
Some(timeout_ms) => {
|
||||
let timeout = Duration::from_millis(timeout_ms);
|
||||
index.query_builder().with_fetch_timeout(timeout)
|
||||
},
|
||||
None => index.query_builder(),
|
||||
};
|
||||
let documents = builder.query(&query, 0..opt.number_results)?;
|
||||
|
||||
let mut retrieve_duration = Duration::default();
|
||||
|
Loading…
Reference in New Issue
Block a user