mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-08 09:30:45 +01:00
Fix
This commit is contained in:
@@ -4,7 +4,9 @@ use axum::{extract::Path, routing::get};
|
|||||||
|
|
||||||
use axum_prometheus::PrometheusMetricLayer;
|
use axum_prometheus::PrometheusMetricLayer;
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
|
use tokio::time;
|
||||||
|
|
||||||
|
use std::time::Duration;
|
||||||
use std::{
|
use std::{
|
||||||
net::SocketAddr,
|
net::SocketAddr,
|
||||||
sync::{
|
sync::{
|
||||||
@@ -115,10 +117,14 @@ pub async fn start_axum_server(stop_signal: Arc<AtomicBool>) {
|
|||||||
axum::Server::bind(&addr)
|
axum::Server::bind(&addr)
|
||||||
.serve(router.into_make_service())
|
.serve(router.into_make_service())
|
||||||
.with_graceful_shutdown(async move {
|
.with_graceful_shutdown(async move {
|
||||||
|
let mut interval = time::interval(Duration::from_secs(1));
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if !stop_signal.load(Ordering::SeqCst) {
|
if !stop_signal.load(Ordering::SeqCst) {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interval.tick().await;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user