mirror of https://github.com/apibillme/broker
wip
This commit is contained in:
parent
3def918c20
commit
c4a2d28b79
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue