mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2026-03-03 07:00:53 +01:00
Fix
This commit is contained in:
@@ -4,7 +4,6 @@ use axum::{extract::Path, routing::get};
|
|||||||
|
|
||||||
use axum_prometheus::PrometheusMetricLayer;
|
use axum_prometheus::PrometheusMetricLayer;
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use tokio::sync::Mutex;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
net::SocketAddr,
|
net::SocketAddr,
|
||||||
@@ -45,9 +44,7 @@ pub async fn start_axum_server(stop_signal: Arc<AtomicBool>) {
|
|||||||
break 'creator;
|
break 'creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
let start_result = start_bot(&bot_data.unwrap(), SERVER_PORT).await;
|
if !start_bot(&bot_data.unwrap(), SERVER_PORT).await {
|
||||||
|
|
||||||
if !start_result {
|
|
||||||
return StatusCode::SERVICE_UNAVAILABLE;
|
return StatusCode::SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,12 +89,11 @@ pub async fn start_axum_server(stop_signal: Arc<AtomicBool>) {
|
|||||||
|
|
||||||
let (prometheus_layer, metric_handle) = PrometheusMetricLayer::pair();
|
let (prometheus_layer, metric_handle) = PrometheusMetricLayer::pair();
|
||||||
|
|
||||||
let start_bot_mutex = Arc::new(Mutex::new(()));
|
// let start_bot_mutex = Arc::new(Mutex::new(()));
|
||||||
|
|
||||||
let app_router = axum::Router::new()
|
let app_router = axum::Router::new()
|
||||||
.route("/:token/", post(telegram_request))
|
.route("/:token/", post(telegram_request))
|
||||||
.layer(prometheus_layer)
|
.layer(prometheus_layer);
|
||||||
.with_state(start_bot_mutex);
|
|
||||||
|
|
||||||
let metric_router =
|
let metric_router =
|
||||||
axum::Router::new().route("/metrics", get(|| async move { metric_handle.render() }));
|
axum::Router::new().route("/metrics", get(|| async move { metric_handle.render() }));
|
||||||
|
|||||||
Reference in New Issue
Block a user