Update ci
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dominic Grimm 2023-02-12 12:59:17 +01:00
parent 7281b536a0
commit 765fcc67dd
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530

View file

@ -54,16 +54,16 @@ async fn posts(
) -> HttpResponse { ) -> HttpResponse {
let db_conn = &mut match db_pool.get() { let db_conn = &mut match db_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let redis_conn = &mut match redis_pool.get() { let redis_conn = &mut match redis_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let posts = match cache::cache_posts(db_conn, redis_conn) { let posts = match cache::cache_posts(db_conn, redis_conn) {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
templates::Posts { posts }.to_response() templates::Posts { posts }.to_response()
@ -79,11 +79,11 @@ async fn post_by_slug(
let db_conn = &mut match db_pool.get() { let db_conn = &mut match db_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let redis_conn = &mut match redis_pool.get() { let redis_conn = &mut match redis_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
if let Some(post_id) = match db::schema::posts::table if let Some(post_id) = match db::schema::posts::table
@ -94,11 +94,11 @@ async fn post_by_slug(
.optional() .optional()
{ {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
} { } {
let post = match cache::cache_post(post_id, db_conn, redis_conn) { let post = match cache::cache_post(post_id, db_conn, redis_conn) {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
templates::PostBySlug { post }.to_response() templates::PostBySlug { post }.to_response()
@ -118,16 +118,16 @@ async fn tags(
) -> HttpResponse { ) -> HttpResponse {
let db_conn = &mut match db_pool.get() { let db_conn = &mut match db_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let redis_conn = &mut match redis_pool.get() { let redis_conn = &mut match redis_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let x = match cache::cache_tags(db_conn, redis_conn) { let x = match cache::cache_tags(db_conn, redis_conn) {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
templates::Tags { tags: x }.to_response() templates::Tags { tags: x }.to_response()
@ -145,11 +145,11 @@ async fn tag_by_name(
let db_conn = &mut match db_pool.get() { let db_conn = &mut match db_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let redis_conn = &mut match redis_pool.get() { let redis_conn = &mut match redis_pool.get() {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let tag_id = match db::schema::tags::table let tag_id = match db::schema::tags::table
@ -158,11 +158,11 @@ async fn tag_by_name(
.first::<i32>(db_conn) .first::<i32>(db_conn)
{ {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
let posts_cache = match cache::cache_tag_posts(tag_id, db_conn, redis_conn) { let posts_cache = match cache::cache_tag_posts(tag_id, db_conn, redis_conn) {
Ok(x) => x, Ok(x) => x,
Err(e) => return HttpResponse::InternalServerError().body(format!("{:?}", e)), Err(_) => return HttpResponse::InternalServerError().finish(),
}; };
templates::TagByName { templates::TagByName {