fix(labrinth): ensure versions get removed from search indexes before ending route execution (#3789)

* fix(labrinth): ensure versions get removed from search indexes before ending route execution

* chore: run `sqlx prepare`

* chore(labrinth): simplify `remove_documents` a little

* chore: tweak new comment
This commit is contained in:
Alejandro González
2025-06-16 17:48:04 +02:00
committed by GitHub
parent 5bdff3929b
commit 97e4d8e132
41 changed files with 888 additions and 971 deletions

View File

@@ -151,22 +151,7 @@ async fn index_swaps() {
test_env.api.remove_project("alpha", USER_USER_PAT).await;
assert_status!(&resp, StatusCode::NO_CONTENT);
// Deletions should not be indexed immediately
let projects = test_env
.api
.search_deserialized(
None,
Some(json!([["categories:fabric"]])),
USER_USER_PAT,
)
.await;
assert_eq!(projects.total_hits, 1);
assert!(projects.hits[0].slug.as_ref().unwrap().contains("alpha"));
// But when we reindex, it should be gone
let resp = test_env.api.reset_search_index().await;
assert_status!(&resp, StatusCode::NO_CONTENT);
// We should wait for deletions to be indexed
let projects = test_env
.api
.search_deserialized(
@@ -177,7 +162,7 @@ async fn index_swaps() {
.await;
assert_eq!(projects.total_hits, 0);
// Reindex again, should still be gone
// When we reindex, it should be still gone
let resp = test_env.api.reset_search_index().await;
assert_status!(&resp, StatusCode::NO_CONTENT);