From 4cd67c3867baef7f902857aff437d00769fdc3c4 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 3 Dec 2024 01:24:02 +0100 Subject: [PATCH] chore: move around test_route --- src/main.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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)]