Enqueues a new [`EngineTask`] for execution. Updates the queue length and notifies listeners of the change.
(&mut self, task: EngineTask<EngineClient_>)
| 394 | /// Enqueues a new [`EngineTask`] for execution. |
| 395 | /// Updates the queue length and notifies listeners of the change. |
| 396 | pub fn enqueue(&mut self, task: EngineTask<EngineClient_>) { |
| 397 | let sequence = self.next_task_sequence; |
| 398 | self.next_task_sequence = |
| 399 | self.next_task_sequence.checked_add(1).expect("engine task sequence overflow"); |
| 400 | self.tasks.push((task, Reverse(sequence))); |
| 401 | self.task_queue_length.send_replace(self.tasks.len()); |
| 402 | Metrics::engine_task_queue_depth().set(self.tasks.len() as f64); |
| 403 | } |
| 404 | |
| 405 | /// Sequentially inserts payloads that authoritatively replace the current unsafe chain. |
| 406 | /// |