mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 05:48:57 +00:00
Batch incremental search event consumption (#6468)
* Batch incremental search event consumption * fmt * fix
This commit is contained in:
@@ -29,6 +29,7 @@ use crate::{
|
||||
},
|
||||
queue::session::AuthQueue,
|
||||
routes::ApiError,
|
||||
search::SearchState,
|
||||
util::{
|
||||
error::Context, http::HttpClient, validate::validation_errors_to_string,
|
||||
},
|
||||
@@ -120,6 +121,7 @@ pub async fn create(
|
||||
redis: web::Data<RedisPool>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
http: web::Data<HttpClient>,
|
||||
search_state: web::Data<SearchState>,
|
||||
web::Json(create): web::Json<ProjectCreate>,
|
||||
) -> Result<web::Json<ProjectId>, CreateError> {
|
||||
// check that the user can make a project
|
||||
@@ -337,6 +339,15 @@ pub async fn create(
|
||||
.await
|
||||
.wrap_internal_err("failed to commit transaction")?;
|
||||
|
||||
super::super::projects::clear_project_cache_and_queue_search(
|
||||
&redis,
|
||||
&search_state,
|
||||
project_id.into(),
|
||||
Some(slug),
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(web::Json(project_id))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user