feat: event-driven parity, Windows shell detection, dirty build timestamps, and gatekeeper integration
This commit is contained in:
1 parent
64857f9d5e
commit
f4dcf3acbf
33 files changed
+3501
-143
No files matched your search
@@ -29,6 +29,7 @@ pub struct SessionCleanup {
|
||||
pub state: Arc<AppState>,
|
||||
pub send_task: tokio::task::JoinHandle<()>,
|
||||
pub recv_task: tokio::task::JoinHandle<()>,
|
||||
pub event_task: tokio::task::JoinHandle<()>,
|
||||
}
|
||||
|
||||
impl Drop for SessionCleanup {
|
||||
@@ -41,6 +42,7 @@ impl Drop for SessionCleanup {
|
||||
.remove(&self.session_id);
|
||||
self.send_task.abort();
|
||||
self.recv_task.abort();
|
||||
self.event_task.abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,11 +149,42 @@ pub async fn handle_socket(socket: WebSocket, state: Arc<AppState>, _client_type
|
||||
}
|
||||
});
|
||||
|
||||
let event_tx = tx.clone();
|
||||
let mut event_bus_rx = state.handler.state.event_bus_tx.subscribe();
|
||||
let event_task = tokio::spawn(async move {
|
||||
while let Ok(event) = event_bus_rx.recv().await {
|
||||
if event.topic == "resource:updated" {
|
||||
if let Some(uri) = event.payload.get("uri").and_then(|u| u.as_str()) {
|
||||
let notif = serde_json::json!({
|
||||
"jsonrpc": "2.0",
|
||||
"method": "notifications/resources/updated",
|
||||
"params": {
|
||||
"uri": uri
|
||||
}
|
||||
});
|
||||
if event_tx.send(notif.to_string()).await.is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if event.topic == "task:event" {
|
||||
let notif = serde_json::json!({
|
||||
"jsonrpc": "2.0",
|
||||
"method": "notifications/task/updated",
|
||||
"params": event.payload
|
||||
});
|
||||
if event_tx.send(notif.to_string()).await.is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let mut cleanup = SessionCleanup {
|
||||
session_id: session_id.clone(),
|
||||
state: Arc::clone(&state),
|
||||
send_task,
|
||||
recv_task,
|
||||
event_task,
|
||||
};
|
||||
|
||||
tokio::select! {
|
||||
@@ -194,6 +227,7 @@ mod tests {
|
||||
|
||||
let send_task = tokio::spawn(async {});
|
||||
let recv_task = tokio::spawn(async {});
|
||||
let event_task = tokio::spawn(async {});
|
||||
|
||||
{
|
||||
let _cleanup = SessionCleanup {
|
||||
@@ -201,6 +235,7 @@ mod tests {
|
||||
state: app_state.clone(),
|
||||
send_task,
|
||||
recv_task,
|
||||
event_task,
|
||||
};
|
||||
} // Drop happens here
|
||||
|
||||
|
||||
Reference in new issue
Block a user