Name update
This commit is contained in:
@@ -36,9 +36,11 @@ pub async fn stream(
|
||||
let rx = state.log_bus.subscribe();
|
||||
let live = BroadcastStream::new(rx).map(|res| match res {
|
||||
Ok(line) => Ok(Event::default().data(line_json(&line))),
|
||||
Err(tokio_stream::wrappers::errors::BroadcastStreamRecvError::Lagged(n)) => Ok(Event::default()
|
||||
.event("lagged")
|
||||
.data(json!({ "skipped": n }).to_string())),
|
||||
Err(tokio_stream::wrappers::errors::BroadcastStreamRecvError::Lagged(n)) => {
|
||||
Ok(Event::default()
|
||||
.event("lagged")
|
||||
.data(json!({ "skipped": n }).to_string()))
|
||||
}
|
||||
});
|
||||
|
||||
Sse::new(recent_stream.chain(live))
|
||||
@@ -55,9 +57,11 @@ pub async fn recent(State(state): State<AppState>) -> Json<serde_json::Value> {
|
||||
/// keep streaming new lines as they arrive).
|
||||
pub async fn clear(State(state): State<AppState>) -> Json<serde_json::Value> {
|
||||
state.log_bus.clear();
|
||||
state
|
||||
.log_bus
|
||||
.push("info", "openpxe::terminal", "log buffer cleared by operator");
|
||||
state.log_bus.push(
|
||||
"info",
|
||||
"openpxe::terminal",
|
||||
"log buffer cleared by operator",
|
||||
);
|
||||
Json(json!({ "ok": true }))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user