Disposes of a worker whose channel died: drains what's left of its messages and returns it as broken (the pool spawns a replacement). The drained events are returned so the guild handler can apply their side effects (db writes for acks etc.) before clearing claim state.
(mut self, pool: &VmWorkerPool)
| 409 | /// The drained events are returned so the guild handler can apply their |
| 410 | /// side effects (db writes for acks etc.) before clearing claim state. |
| 411 | pub fn destroy_broken(mut self, pool: &VmWorkerPool) -> Vec<SessionEvent> { |
| 412 | let mut events = Vec::new(); |
| 413 | while let Ok(msg) = self.worker.rx.try_recv() { |
| 414 | events.extend(self.handle_worker_msg(Some(msg))); |
| 415 | } |
| 416 | |
| 417 | self.worker.session_state = None; |
| 418 | pool.return_worker(self.worker, true); |
| 419 | |
| 420 | events |
| 421 | } |
| 422 | |
| 423 | pub fn worker_id(&self) -> u64 { |
| 424 | self.worker.worker_id |
no test coverage detected