make repository updates non-blocking

This commit is contained in:
Aravinth Manivannan 2021-10-30 15:37:24 +05:30
parent 8cd9f0030d
commit ef424cf070
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 6 additions and 3 deletions

View file

@ -44,7 +44,11 @@ async fn update(payload: web::Json<DeployEvent>) -> impl Responder {
let mut found = false;
for page in SETTINGS.pages.iter() {
if page.secret == payload.secret {
page.fetch_upstream(&page.branch);
web::block(|| {
page.fetch_upstream(&page.branch);
})
.await
.unwrap();
found = true;
}
}

View file

@ -71,9 +71,8 @@ async fn main() -> std::io::Result<()> {
actix_middleware::TrailingSlash::Trim,
))
.configure(services)
// .app_data(data.clone())
})
.workers(SETTINGS.server.workers.unwrap_or(num_cpus::get()))
.workers(SETTINGS.server.workers.unwrap_or_else(num_cpus::get))
.bind(SETTINGS.server.get_ip())
.unwrap()
.run()