diff --git a/src/main.rs b/src/main.rs index 9983119..4c11962 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,7 +69,7 @@ async fn entry(cli: Cli, config: Config, db: Database) -> Result<(), Box Some(rtt), Err(e) => { @@ -98,6 +98,15 @@ async fn entry(cli: Cli, config: Config, db: Database) -> Result<(), Box reqwest::Result { + let before = chrono::Utc::now(); + reqwest::get(url) + .await? + .error_for_status()?; + let delta = chrono::Utc::now() - before; + Ok(delta.num_milliseconds()) +} + // ============= APIs @@ -129,15 +138,6 @@ async fn root() -> Html<&'static str> { Html(include_str!("../index.html")) } -async fn test(url: &str) -> reqwest::Result { - let before = chrono::Utc::now(); - reqwest::get(url) - .await? - .error_for_status()?; - let delta = chrono::Utc::now() - before; - Ok(delta.num_milliseconds()) -} - use axum::{extract::{Path, Query, State}, response::{Html, IntoResponse}, Json}; #[derive(serde::Deserialize)]