replace qualified path with use
parent
dfce42fd03
commit
239b332b48
10
src/api.rs
10
src/api.rs
|
@ -17,7 +17,10 @@ use diesel::{ExpressionMethods, OptionalExtension, QueryDsl, SelectableHelper};
|
||||||
use diesel_async::{scoped_futures::ScopedFutureExt, AsyncConnection, RunQueryDsl};
|
use diesel_async::{scoped_futures::ScopedFutureExt, AsyncConnection, RunQueryDsl};
|
||||||
use futures_util::Stream;
|
use futures_util::Stream;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tokio_stream::{wrappers::errors::BroadcastStreamRecvError, StreamExt as _};
|
use tokio_stream::{
|
||||||
|
wrappers::{errors::BroadcastStreamRecvError, BroadcastStream},
|
||||||
|
StreamExt as _,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::AppState;
|
use crate::AppState;
|
||||||
|
|
||||||
|
@ -178,9 +181,8 @@ async fn add_dancer(
|
||||||
async fn ada_subscribe(
|
async fn ada_subscribe(
|
||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
) -> Sse<impl Stream<Item = Result<Event, BroadcastStreamRecvError>>> {
|
) -> Sse<impl Stream<Item = Result<Event, BroadcastStreamRecvError>>> {
|
||||||
let stream =
|
let stream = BroadcastStream::new(state.sse_handler.ada_sender.subscribe())
|
||||||
tokio_stream::wrappers::BroadcastStream::new(state.sse_handler.ada_sender.subscribe())
|
.map(|r| r.map(|s| Event::default().event("ada").data(s)));
|
||||||
.map(|r| r.map(|s| Event::default().event("ada").data(s)));
|
|
||||||
|
|
||||||
Sse::new(stream).keep_alive(KeepAlive::default())
|
Sse::new(stream).keep_alive(KeepAlive::default())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue