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

Function per_db_pressure_reported

nodedb/src/bridge/dispatch.rs:635–655  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

633
634 #[test]
635 fn per_db_pressure_reported() {
636 let (mut dispatcher, _) = Dispatcher::new(1, 8);
637 // Fill fair share for DB 1 using 4 of 8 slots.
638 // With one DB initially, fair share = 8. With two DBs = 4 each.
639 // First enqueue DB1 + DB2, so fair_share = 4.
640 for i in 0..4u64 {
641 dispatcher
642 .dispatch(make_request_for_db(0, 1, i + 10))
643 .unwrap();
644 }
645 for i in 0..4u64 {
646 dispatcher
647 .dispatch(make_request_for_db(0, 2, i + 20))
648 .unwrap();
649 }
650 // After filling DB1's fair share, it should be suspended on core 0.
651 // (exact state depends on WFQ flush draining items to ring first)
652 // The test confirms per-DB pressure is being tracked without panic.
653 let _ = dispatcher.db_pressure_on_core(0, 1);
654 let _ = dispatcher.db_pressure_on_core(0, 2);
655 }
656}

Callers

nothing calls this directly

Calls 3

make_request_for_dbFunction · 0.85
db_pressure_on_coreMethod · 0.80
dispatchMethod · 0.45

Tested by

no test coverage detected