MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / backpressure_thresholds_per_virtual_queue

Function backpressure_thresholds_per_virtual_queue

nodedb-bridge/src/wfq.rs:376–396  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

374
375 #[test]
376 fn backpressure_thresholds_per_virtual_queue() {
377 let mut wfq: WeightedFairQueue<u32> = WeightedFairQueue::new(8, 100);
378 wfq.set_priority(1, PriorityClass::Standard);
379 wfq.set_priority(2, PriorityClass::Standard);
380
381 // Fair share = 8 / 2 = 4 per DB.
382 // Push 3 items into DB 1 → 3/4 = 75% → not throttled.
383 for _ in 0..3 {
384 wfq.try_enqueue(1, 0).unwrap();
385 }
386 assert!(!wfq.is_throttled_for(1));
387 assert!(!wfq.is_suspended_for(1));
388
389 // Push 1 more → 4/4 = 100% → throttled AND suspended.
390 wfq.try_enqueue(1, 0).unwrap();
391 assert!(wfq.is_throttled_for(1));
392 assert!(wfq.is_suspended_for(1));
393
394 // DB 2 is untouched → not throttled.
395 assert!(!wfq.is_throttled_for(2));
396 }
397}

Callers

nothing calls this directly

Calls 2

set_priorityMethod · 0.80
try_enqueueMethod · 0.80

Tested by

no test coverage detected