mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-29 22:01:59 +02:00
refactoring: new structure and mailer
This commit is contained in:
17
src/server/routes/api/queue_length.rs
Normal file
17
src/server/routes/api/queue_length.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use axum::{extract::State, http::StatusCode, response::IntoResponse};
|
||||
use tracing::info;
|
||||
|
||||
use crate::{error::ApiError, server::AppState};
|
||||
|
||||
pub async fn queue_length_handler(
|
||||
State(state): State<AppState>,
|
||||
) -> Result<impl IntoResponse, ApiError> {
|
||||
info!("Getting queue length");
|
||||
|
||||
let queue_length = state.rabbitmq_consumer.get_queue_length().await?;
|
||||
|
||||
info!("Queue length: {}", queue_length);
|
||||
|
||||
// Return the queue length with a 200 OK status
|
||||
Ok((StatusCode::OK, queue_length.to_string()))
|
||||
}
|
||||
Reference in New Issue
Block a user