This commit is contained in:
Bevan Hunt 2020-02-02 13:20:17 -08:00
parent 3def918c20
commit c4a2d28b79
1 changed files with 3 additions and 4 deletions

View File

@ -383,7 +383,7 @@ fn event_stream(allowed: bool) -> Result<impl ServerSentEvent, Infallible> {
if allowed {
let (_, rx) = CHANNEL.get(&"chan".to_owned()).unwrap();
let sse = match rx.try_recv() {
let sse = match rx.clone().try_recv() {
Ok(sse) => sse,
Err(_) => {
let guid = Uuid::new_v4().to_string();
@ -592,8 +592,7 @@ pub async fn broker() {
});
let sse_route = warp::path("events")
.and(auth_check)
.and(warp::get()).map(move |jwt: JWT| {
.and(warp::get()).map(move || {
let tree = TREE.get(&"tree".to_owned()).unwrap();
let mut vals : Vec<Event> = tree.iter().into_iter().filter(|x| {
let p = x.as_ref().unwrap();
@ -675,7 +674,7 @@ pub async fn broker() {
}
let event_stream = interval(Duration::from_millis(100)).map(move |_| {
event_stream(jwt.check)
event_stream(true)
});
warp::sse::reply(event_stream)