Skip to content

Commit

Permalink
fix: oops, improve the health check (#97)
Browse files Browse the repository at this point in the history
Closes #96
  • Loading branch information
pjenvey committed Sep 24, 2021
1 parent 35614eb commit d26e6d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly
nightly-2020-01-09
9 changes: 3 additions & 6 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::env;
use std::io::Read;
use std::time::Instant;

use diesel::{dsl::sql, sql_types::Integer, OptionalExtension, QueryDsl, RunQueryDsl};
use diesel::RunQueryDsl;
use failure::ResultExt;
use lazy_static::lazy_static;
use regex::Regex;
Expand All @@ -25,7 +25,6 @@ use crate::auth;
use crate::db::{
self,
models::{Broadcaster, Reader},
schema::broadcastsv1,
};
use crate::error::{HandlerError, HandlerErrorKind, HandlerResult, Result, VALIDATION_FAILED};
use crate::logging::{self, RequestLogger};
Expand Down Expand Up @@ -179,10 +178,8 @@ fn version() -> content::Json<&'static str> {
#[get("/__heartbeat__")]
fn heartbeat(conn: HandlerResult<db::Conn>, log: RequestLogger) -> status::Custom<JsonValue> {
let result = conn.and_then(|conn| {
Ok(broadcastsv1::table
.select(sql::<Integer>("1"))
.get_result::<i32>(&*conn)
.optional()
Ok(diesel::sql_query("SELECT 1")
.execute(&*conn)
.context(HandlerErrorKind::DBError)?)
});

Expand Down

0 comments on commit d26e6d2

Please sign in to comment.