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

Method tick

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

Run one iteration of the event loop: drain requests, process tasks. After processing, update the per-priority queue-depth gauges so the Prometheus endpoint reflects the post-tick state.

(&mut self)

Source from the content-addressed store, hash-verified

121 /// After processing, update the per-priority queue-depth gauges so the
122 /// Prometheus endpoint reflects the post-tick state.
123 pub fn tick(&mut self) -> usize {
124 self.poll_build_completions();
125 self.poll_pending_reindex();
126 // Adjust SPSC read depth based on current memory pressure.
127 self.apply_spsc_pressure();
128 self.drain_requests();
129 let mut processed = 0;
130 while !self.task_queue.is_empty() {
131 let batched = self.poll_write_batch();
132 if batched > 0 {
133 processed += batched;
134 continue;
135 }
136 if self.poll_one() {
137 processed += 1;
138 } else {
139 break;
140 }
141 }
142
143 // Update queue-depth gauges after draining.
144 self.io_metrics
145 .record_queue_depth(TIER_CRITICAL, self.task_queue.critical_len() as u64);
146 self.io_metrics
147 .record_queue_depth(TIER_HIGH, self.task_queue.high_len() as u64);
148 self.io_metrics
149 .record_queue_depth(TIER_LOW, self.task_queue.low_len() as u64);
150
151 processed
152 }
153}

Calls 11

poll_pending_reindexMethod · 0.80
apply_spsc_pressureMethod · 0.80
poll_write_batchMethod · 0.80
poll_oneMethod · 0.80
record_queue_depthMethod · 0.80
critical_lenMethod · 0.80
high_lenMethod · 0.80
low_lenMethod · 0.80
drain_requestsMethod · 0.45
is_emptyMethod · 0.45