summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2023-10-24 14:56:17 +0200
committerFxQnLr <[email protected]>2023-10-24 14:56:17 +0200
commitf9224ff02e688dec819ab81893320a0611f2a198 (patch)
treebfb5376bfb563c295737aba2783c3e0c2ac1b924 /src/main.rs
parentdcfb83fb2069bfcf4642b03453253e35479bf3da (diff)
downloadwebol-f9224ff02e688dec819ab81893320a0611f2a198.tar
webol-f9224ff02e688dec819ab81893320a0611f2a198.tar.gz
webol-f9224ff02e688dec819ab81893320a0611f2a198.zip
Seems to work
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 2 insertions, 10 deletions
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};
4use axum::routing::{get, put}; 4use axum::routing::{get, put};
5use sqlx::PgPool; 5use sqlx::PgPool;
6use time::util::local_offset; 6use time::util::local_offset;
7use tokio::sync::mpsc::{self, Sender}; 7use tokio::sync::broadcast::{channel, Sender};
8use tracing::{info, level_filters::LevelFilter}; 8use tracing::{info, level_filters::LevelFilter};
9use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*}; 9use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*};
10use crate::config::SETTINGS; 10use crate::config::SETTINGS;
@@ -46,15 +46,8 @@ async fn main() {
46 let db = init_db_pool().await; 46 let db = init_db_pool().await;
47 sqlx::migrate!().run(&db).await.unwrap(); 47 sqlx::migrate!().run(&db).await.unwrap();
48 48
49 let (tx, mut rx) = mpsc::channel(32); 49 let (tx, _) = channel(32);
50 50
51 // FIXME: once_cell? or just static mutable
52 tokio::spawn( async move {
53 while let Some(message) = rx.recv().await {
54 println!("GOT = {}", message);
55 }
56 });
57
58 let shared_state = Arc::new(AppState { db, ping_send: tx }); 51 let shared_state = Arc::new(AppState { db, ping_send: tx });
59 52
60 let app = Router::new() 53 let app = Router::new()
@@ -76,5 +69,4 @@ async fn main() {
76pub struct AppState { 69pub struct AppState {
77 db: PgPool, 70 db: PgPool,
78 ping_send: Sender<String>, 71 ping_send: Sender<String>,
79 // ping_receive: Receiver<String>
80} 72}