From f9224ff02e688dec819ab81893320a0611f2a198 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Tue, 24 Oct 2023 14:56:17 +0200 Subject: Seems to work --- src/main.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 9c31ec8..124c44e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use axum::{Router, routing::post}; use axum::routing::{get, put}; use sqlx::PgPool; use time::util::local_offset; -use tokio::sync::mpsc::{self, Sender}; +use tokio::sync::broadcast::{channel, Sender}; use tracing::{info, level_filters::LevelFilter}; use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*}; use crate::config::SETTINGS; @@ -46,15 +46,8 @@ async fn main() { let db = init_db_pool().await; sqlx::migrate!().run(&db).await.unwrap(); - let (tx, mut rx) = mpsc::channel(32); + let (tx, _) = channel(32); - // FIXME: once_cell? or just static mutable - tokio::spawn( async move { - while let Some(message) = rx.recv().await { - println!("GOT = {}", message); - } - }); - let shared_state = Arc::new(AppState { db, ping_send: tx }); let app = Router::new() @@ -76,5 +69,4 @@ async fn main() { pub struct AppState { db: PgPool, ping_send: Sender, - // ping_receive: Receiver } -- cgit v1.2.3