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

Method drain_requests

nodedb/src/data/executor/core_loop/tick.rs:19–30  ·  view source on GitHub ↗

Drain incoming requests from the SPSC bridge into the priority queues. The number of requests drained per call is bounded by `spsc_read_depth`, which is reduced under Critical memory pressure and set to zero under Emergency. Each request is routed to the Critical, High, or Low tier based on `Request.priority`.

(&mut self)

Source from the content-addressed store, hash-verified

17 /// Emergency. Each request is routed to the Critical, High, or Low tier
18 /// based on `Request.priority`.
19 pub fn drain_requests(&mut self) {
20 if self.pressure_suspend_reads {
21 // Emergency pressure: do not accept new requests.
22 return;
23 }
24 let depth = self.spsc_read_depth.max(1);
25 let mut batch = Vec::new();
26 self.request_rx.drain_into(&mut batch, depth);
27 for br in batch {
28 self.task_queue.push(ExecutionTask::new(br.inner));
29 }
30 }
31
32 /// Process the next pending task using the 8:4:2 priority drain ratio.
33 ///

Callers 5

drain_and_rejectFunction · 0.45
tickMethod · 0.45

Calls 2

drain_intoMethod · 0.45
pushMethod · 0.45

Tested by 3