summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2023-10-29 20:30:01 +0100
committerFxQnLr <[email protected]>2023-10-29 20:30:01 +0100
commit84c32953ae5f52be44af4b48381747f55cb04f4a (patch)
tree6b7ffd4d7ac7b89bb9bf169be7ba6d266f79d650 /src/main.rs
parent0cca10290d089aabac8f2e4356cfaf80f06ae194 (diff)
downloadwebol-84c32953ae5f52be44af4b48381747f55cb04f4a.tar
webol-84c32953ae5f52be44af4b48381747f55cb04f4a.tar.gz
webol-84c32953ae5f52be44af4b48381747f55cb04f4a.zip
impl dashmap
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 545d8fe..762a817 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,12 +1,11 @@
1use std::collections::HashMap;
2use std::env; 1use std::env;
3use std::sync::Arc; 2use std::sync::Arc;
4use axum::{Router, routing::post}; 3use axum::{Router, routing::post};
5use axum::routing::{get, put}; 4use axum::routing::{get, put};
5use dashmap::DashMap;
6use sqlx::PgPool; 6use sqlx::PgPool;
7use time::util::local_offset; 7use time::util::local_offset;
8use tokio::sync::broadcast::{channel, Sender}; 8use tokio::sync::broadcast::{channel, Sender};
9use tokio::sync::Mutex;
10use tracing::{info, level_filters::LevelFilter}; 9use tracing::{info, level_filters::LevelFilter};
11use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*}; 10use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*};
12use crate::config::SETTINGS; 11use crate::config::SETTINGS;
@@ -51,9 +50,9 @@ async fn main() {
51 50
52 let (tx, _) = channel(32); 51 let (tx, _) = channel(32);
53 52
54 let ping_map: HashMap<String, (String, bool)> = HashMap::new(); 53 let ping_map: DashMap<String, (String, bool)> = DashMap::new();
55 54
56 let shared_state = Arc::new(AppState { db, ping_send: tx, ping_map: Arc::new(Mutex::new(ping_map)) }); 55 let shared_state = Arc::new(AppState { db, ping_send: tx, ping_map: Arc::new(ping_map) });
57 56
58 let app = Router::new() 57 let app = Router::new()
59 .route("/start", post(start)) 58 .route("/start", post(start))