fixes-3
This commit is contained in:
parent
65821f561d
commit
152a8da157
|
@ -96,7 +96,7 @@ async fn sse_handler(
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let (tx, rx) = broadcast::channel(100);
|
let (tx, mut rx) = broadcast::channel(100);
|
||||||
let redis_url = env::var("REDIS_URL").unwrap();
|
let redis_url = env::var("REDIS_URL").unwrap();
|
||||||
let client = redis::Client::open(redis_url).unwrap();
|
let client = redis::Client::open(redis_url).unwrap();
|
||||||
let _handle = tokio::spawn(async move {
|
let _handle = tokio::spawn(async move {
|
||||||
|
@ -114,8 +114,9 @@ async fn main() -> std::io::Result<()> {
|
||||||
});
|
});
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
|
let rx = tx.subscribe();
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(rx.subscribe()))
|
.app_data(web::Data::new(rx))
|
||||||
.app_data(web::Data::new(client.clone()))
|
.app_data(web::Data::new(client.clone()))
|
||||||
.route("/aware/{token}", web::get().to(sse_handler))
|
.route("/aware/{token}", web::get().to(sse_handler))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user