From 7a192acc99358818c2f90cf4e2b8b236f91cfbf7 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 13 Mar 2025 20:13:58 +0000 Subject: properly remove from the EntityIdIndex component on despawn --- azalea/src/swarm/mod.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'azalea/src') diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 04bc94dc..c8546c2b 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -698,10 +698,33 @@ impl Swarm { ) { while let Some(event) = rx.recv().await { if rx.len() > 1_000 { - static WARNED: AtomicBool = AtomicBool::new(false); - if !WARNED.swap(true, atomic::Ordering::Relaxed) { + static WARNED_1_000: AtomicBool = AtomicBool::new(false); + if !WARNED_1_000.swap(true, atomic::Ordering::Relaxed) { warn!("the client's Event channel has more than 1000 items!") } + + if rx.len() > 10_000 { + static WARNED_10_000: AtomicBool = AtomicBool::new(false); + if !WARNED_10_000.swap(true, atomic::Ordering::Relaxed) { + warn!("the client's Event channel has more than 10,000 items!!") + } + + if rx.len() > 100_000 { + static WARNED_100_000: AtomicBool = AtomicBool::new(false); + if !WARNED_100_000.swap(true, atomic::Ordering::Relaxed) { + warn!("the client's Event channel has more than 100,000 items!!!") + } + + if rx.len() > 1_000_000 { + static WARNED_1_000_000: AtomicBool = AtomicBool::new(false); + if !WARNED_1_000_000.swap(true, atomic::Ordering::Relaxed) { + warn!( + "the client's Event channel has more than 1,000,000 items!!!! i sincerely hope no one ever sees this warning" + ) + } + } + } + } } // we can't handle events here (since we can't copy the handler), -- cgit v1.2.3