Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ doctest = false

[dependencies]
par-rs = { git = "https://github.com/Appz4Fun/par-rs", rev = "e471c49a29f9ee40af9bd0bf60b7dec63cf74a4b" }
zipfast = { git = "https://github.com/Appz4Fun/zipfast", rev = "fa031ee751ee294d6fb589b6caa1e986de3fdf1b", features = ["persistent-partials"] }
zipfast = { git = "https://github.com/Appz4Fun/zipfast", rev = "c7ee07dbf4c9817bb8d0dbf07684c643932a96e5", features = ["persistent-partials"] }
vidmatch = { git = "https://github.com/Appz4Fun/vidmatch", rev = "819206601b780f314081225d8156843787ea082d" }
zipview = { git = "https://github.com/xbmc4lyfe/zipview", rev = "2c3d73a06b29987cea1510e903e437a482076745" }
# nntp-rs v0.4.4+ (one-pass yEnc decode)
nntp-rs = { git = "https://github.com/Appz4Fun/nntp-rs", rev = "cf5df57ac49c6709ddde86f3f7eeff49e032821d", default-features = false, features = ["blocking", "openssl"] }
crc32fast = "1.5"
Expand Down
24 changes: 17 additions & 7 deletions rust/src/articledl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,17 @@ fn memory_monitor_update_state() -> i32 {
let slot_current = PressureTier::from_i32(MEM_SLOT_TIER.load(Ordering::Relaxed));
let (slot_next, slot_changed) = {
let mut gate = MEM_SLOT_GATE.lock().unwrap_or_else(|e| e.into_inner());
mp::slot_gate_step(
slot_raw,
slot_current,
&mut gate,
mp::slot_persist_samples(interval),
)
if (slot_current as i32) > next_tier {
*gate = Default::default();
(PressureTier::from_i32(next_tier), true)
} else {
mp::slot_gate_step(
slot_raw,
slot_current,
&mut gate,
mp::slot_persist_samples(interval),
)
}
};

if transitioned {
Expand All @@ -557,7 +562,12 @@ fn memory_monitor_update_state() -> i32 {

if slot_changed {
MEM_SLOT_TIER.store(slot_next as i32, Ordering::Release);
let why = mp::describe_source(decision.slot_source, &metrics, budget);
let src = if decision.slot_source == mp::PressureSource::None {
decision.cache_source
} else {
decision.slot_source
};
let why = mp::describe_source(src, &metrics, budget);
let msg = match slot_next {
PressureTier::Critical => {
format!("Memory pressure persisted ({why}): download slots cut to a quarter")
Expand Down
2 changes: 1 addition & 1 deletion rust/src/qqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl RawLock {
#[inline]
fn try_take(&self) -> bool {
self.locked
.compare_exchange(false, true, Ordering::SeqCst, Ordering::Relaxed)
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
}

Expand Down
Loading
Loading