Refactor: Dismantle MemoryState into semantic domain sub-structs
This commit is contained in:
1 parent
0e866f2465
commit
a34554b7ff
13 files changed
+186
-158
No files matched your search
@@ -79,7 +79,7 @@ use crate::models::TerminalHistory;
|
||||
pub async fn get_terminal_history_handler(
|
||||
State(state): State<Arc<AppState>>,
|
||||
) -> impl axum::response::IntoResponse {
|
||||
let history_json = state.handler.state.terminal_history.read_with(|h| serde_json::to_string(h).unwrap_or_else(|_| "[]".to_string()));
|
||||
let history_json = state.handler.state.telemetry.terminal_history.read_with(|h| serde_json::to_string(h).unwrap_or_else(|_| "[]".to_string()));
|
||||
([(axum::http::header::CONTENT_TYPE, "application/json")], history_json)
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ pub async fn terminal_telemetry_handler(
|
||||
State(state): State<Arc<AppState>>,
|
||||
axum::Json(payload): axum::Json<TerminalHistory>,
|
||||
) -> impl axum::response::IntoResponse {
|
||||
state.handler.state.terminal_history.modify(|history| {
|
||||
state.handler.state.telemetry.terminal_history.modify(|history| {
|
||||
history.push_front(payload.clone());
|
||||
if history.len() > 100 {
|
||||
history.pop_back();
|
||||
|
||||
Reference in new issue
Block a user