MCPcopy Create free account
hub / github.com/Botloader/botloader / destroy_broken

Method destroy_broken

components/scheduler/src/vm_session.rs:411–421  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

handle_session_eventsMethod · 0.80

Calls 2

handle_worker_msgMethod · 0.80
return_workerMethod · 0.80

Tested by

no test coverage detected