fix blocking code in asynch

This commit is contained in:
2023-10-04 18:21:18 +02:00
parent bdf96b366a
commit 7e6cfa7f8f
3 changed files with 687 additions and 590 deletions

1271
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
FROM rust:1.61 as builder FROM rust:1.72 as builder
RUN apt-get update && apt-get install -y sqlite3 && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y sqlite3 && rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/ics-proxy WORKDIR /usr/src/ics-proxy
COPY . . COPY . .

View File

@@ -26,8 +26,8 @@ async fn make_ics_request(req: HttpRequest, db_pool: web::Data<Pool<Sqlite>>) ->
match Uuid::parse_str(id) { match Uuid::parse_str(id) {
Ok(uuid) => match Link::find_by_uuid(uuid.to_string(), db_pool).await { Ok(uuid) => match Link::find_by_uuid(uuid.to_string(), db_pool).await {
Ok(link) => match reqwest::blocking::get(link.destination) { Ok(link) => match reqwest::get(link.destination).await {
Ok(r) => match r.text() { Ok(r) => match r.text().await {
Ok(res) => HttpResponse::Ok().content_type("text/calendar").body(res), Ok(res) => HttpResponse::Ok().content_type("text/calendar").body(res),
Err(err) => HttpResponse::Ok() Err(err) => HttpResponse::Ok()
.status(StatusCode::INTERNAL_SERVER_ERROR) .status(StatusCode::INTERNAL_SERVER_ERROR)