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

Method poll_responses

nodedb/src/bridge/dispatch.rs:441–459  ·  view source on GitHub ↗

Poll responses from all Data Plane cores.

(&mut self)

Source from the content-addressed store, hash-verified

439
440 /// Poll responses from all Data Plane cores.
441 pub fn poll_responses(&mut self) -> Vec<envelope::Response> {
442 let mut responses = Vec::new();
443 for channel in &mut self.cores {
444 let mut batch = Vec::new();
445 channel.response_rx.drain_into(&mut batch, 64);
446 for br in batch {
447 let rid = br.inner.request_id.as_u64();
448 if let Some(tid) = self.request_tenant.remove(&rid)
449 && let Some(count) = self.tenant_inflight.get_mut(&tid)
450 {
451 *count = count.saturating_sub(1);
452 }
453 responses.push(br.inner);
454 }
455 // Opportunistically flush WFQ after draining responses to fill headroom.
456 channel.flush_wfq();
457 }
458 responses
459 }
460
461 /// Number of Data Plane cores.
462 pub fn num_cores(&self) -> usize {

Calls 6

flush_wfqMethod · 0.80
drain_intoMethod · 0.45
as_u64Method · 0.45
removeMethod · 0.45
get_mutMethod · 0.45
pushMethod · 0.45

Tested by 2

response_roundtripFunction · 0.64