diff --git a/.cargo/config.toml b/.cargo/config.toml index e11d56a31..b172ee2af 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,5 @@ [alias] xtask = "run --release --package xtask --" + +[build] +rustflags = ["--cfg", "tokio_unstable", "--cfg", "tokio_taskdump"] diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 6cf8bfa0f..100068965 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -158,6 +158,8 @@ jobs: uses: Swatinem/rust-cache@v2.7.8 - name: Run tests in debug uses: actions-rs/cargo@v1 + env: + RUSTFLAGS: "--cfg tokio_unstable --cfg tokio_taskdump" with: command: test args: --locked --all diff --git a/crates/meilisearch/tests/common/server.rs b/crates/meilisearch/tests/common/server.rs index 7e30c5d17..02ea2f79a 100644 --- a/crates/meilisearch/tests/common/server.rs +++ b/crates/meilisearch/tests/common/server.rs @@ -400,12 +400,8 @@ impl Server { // try several times to get status, or panic to not wait forever let url = format!("/tasks/{}", update_id); // Increase timeout for vector-related tests - let max_attempts = if url.contains("/tasks/") { - if update_id > 1000 { - 400 // 200 seconds for vector tests - } else { - 100 // 50 seconds for other tests - } + let max_attempts = if update_id > 1000 { + 400 // 200 seconds for vector tests } else { 100 // 50 seconds for other tests }; @@ -421,6 +417,14 @@ impl Server { // wait 0.5 second. sleep(Duration::from_millis(500)).await; } + let handle = tokio::runtime::Handle::current(); + if let Ok(dump) = tokio::time::timeout(Duration::from_secs(2), handle.dump()).await { + for (i, task) in dump.tasks().iter().enumerate() { + let trace = task.trace(); + println!("TASK {i}:"); + println!("{trace}\n"); + } + } panic!("Timeout waiting for update id"); }