debug: add SSE logging to trace torrent loading issue
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
This commit is contained in:
@@ -114,7 +114,9 @@ pub fn provide_torrent_store() {
|
|||||||
|
|
||||||
Effect::new(move |_| {
|
Effect::new(move |_| {
|
||||||
let user_val = user.get();
|
let user_val = user.get();
|
||||||
|
log::debug!("SSE Effect: user = {:?}", user_val);
|
||||||
if user_val.is_none() {
|
if user_val.is_none() {
|
||||||
|
log::debug!("SSE Effect: user is None, skipping connection");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +153,7 @@ pub fn provide_torrent_store() {
|
|||||||
if let Ok(event) = serde_json::from_str::<AppEvent>(&data_str) {
|
if let Ok(event) = serde_json::from_str::<AppEvent>(&data_str) {
|
||||||
match event {
|
match event {
|
||||||
AppEvent::FullList { torrents: list, .. } => {
|
AppEvent::FullList { torrents: list, .. } => {
|
||||||
|
log::debug!("SSE: Received FullList with {} torrents", list.len());
|
||||||
torrents.update(|map| {
|
torrents.update(|map| {
|
||||||
let new_hashes: std::collections::HashSet<String> = list.iter().map(|t| t.hash.clone()).collect();
|
let new_hashes: std::collections::HashSet<String> = list.iter().map(|t| t.hash.clone()).collect();
|
||||||
map.retain(|hash, _| new_hashes.contains(hash));
|
map.retain(|hash, _| new_hashes.contains(hash));
|
||||||
@@ -158,6 +161,7 @@ pub fn provide_torrent_store() {
|
|||||||
map.insert(new_torrent.hash.clone(), new_torrent);
|
map.insert(new_torrent.hash.clone(), new_torrent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
log::debug!("SSE: torrents map now has {} entries", torrents.with(|m| m.len()));
|
||||||
}
|
}
|
||||||
AppEvent::Update(update) => {
|
AppEvent::Update(update) => {
|
||||||
torrents.update(|map| {
|
torrents.update(|map| {
|
||||||
|
|||||||
Reference in New Issue
Block a user