chore(ui): remove debugging logs for sse connection
All checks were successful
Build MIPS Binary / build (push) Successful in 1m56s
All checks were successful
Build MIPS Binary / build (push) Successful in 1m56s
This commit is contained in:
@@ -88,13 +88,10 @@ pub fn provide_torrent_store() {
|
|||||||
let mut disconnect_notified = false;
|
let mut disconnect_notified = false;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
log::info!("[SSE] Attempting to connect to /api/events...");
|
|
||||||
let es_result = EventSource::new("/api/events");
|
let es_result = EventSource::new("/api/events");
|
||||||
match es_result {
|
match es_result {
|
||||||
Ok(mut es) => {
|
Ok(mut es) => {
|
||||||
log::info!("[SSE] EventSource instantiated successfully.");
|
|
||||||
if let Ok(mut stream) = es.subscribe("message") {
|
if let Ok(mut stream) = es.subscribe("message") {
|
||||||
log::info!("[SSE] Subscribed to 'message' events.");
|
|
||||||
let mut got_first_message = false;
|
let mut got_first_message = false;
|
||||||
while let Some(Ok((_, msg))) = stream.next().await {
|
while let Some(Ok((_, msg))) = stream.next().await {
|
||||||
if !got_first_message {
|
if !got_first_message {
|
||||||
@@ -108,11 +105,8 @@ pub fn provide_torrent_store() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(data_str) = msg.data().as_string() {
|
if let Some(data_str) = msg.data().as_string() {
|
||||||
log::info!("[SSE] Received message: {:?}", data_str.chars().take(50).collect::<String>());
|
if let Ok(bytes) = BASE64.decode(&data_str) {
|
||||||
match BASE64.decode(&data_str) {
|
if let Ok(event) = rmp_serde::from_slice::<AppEvent>(&bytes) {
|
||||||
Ok(bytes) => {
|
|
||||||
match rmp_serde::from_slice::<AppEvent>(&bytes) {
|
|
||||||
Ok(event) => {
|
|
||||||
match event {
|
match event {
|
||||||
AppEvent::FullList(list, _) => {
|
AppEvent::FullList(list, _) => {
|
||||||
torrents_for_sse.update(|map| {
|
torrents_for_sse.update(|map| {
|
||||||
@@ -134,14 +128,6 @@ pub fn provide_torrent_store() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
log::error!("[SSE] Failed to deserialize AppEvent: {:?}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
log::error!("[SSE] Failed to decode base64: {:?}", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user