Skip to content

Commit 8c71b16

Browse files
skeptrunedevcdxker
authored andcommitted
feat: offload document processing to an Arbiter for improved async handling
1 parent a8df4c4 commit 8c71b16

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

server/src/handlers/file_handler.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::{
1818
organization_operator::{get_file_size_sum_org, hash_function},
1919
},
2020
};
21+
use actix::Arbiter;
2122
use actix_web::{web, HttpResponse};
2223
use base64::{
2324
alphabet,
@@ -720,14 +721,16 @@ pub async fn upload_html_page(
720721
return Err(ServiceError::BadRequest("Webhook secret does not match.".to_string()).into());
721722
}
722723

723-
process_crawl_doc(
724-
dataset_id,
725-
req_payload.scrape_id,
726-
req_payload.data,
727-
broccoli_queue,
728-
pool,
729-
)
730-
.await?;
724+
Arbiter::new().spawn(async move {
725+
let _ = process_crawl_doc(
726+
dataset_id,
727+
req_payload.scrape_id,
728+
req_payload.data,
729+
broccoli_queue,
730+
pool,
731+
)
732+
.await;
733+
});
731734

732735
Ok(HttpResponse::NoContent().finish())
733736
}

0 commit comments

Comments
 (0)