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

Method restart

components/vm/src/vm.rs:538–570  ·  view source on GitHub ↗
(&mut self, new_scripts: Vec<Script>)

Source from the content-addressed store, hash-verified

536 }
537
538 async fn restart(&mut self, new_scripts: Vec<Script>) {
539 self.guild_logger
540 .log(CreateLogEntry::info("restarting guild vm...".to_string()));
541
542 self.stop_vm().await;
543
544 // create a new sandbox
545 {
546 let mut borrow = self.script_store.borrow_mut();
547 borrow.clear();
548 };
549
550 for script in &new_scripts {
551 self.compile_script(script.clone());
552 }
553
554 let new_rt = Self::create_isolate(
555 &self.extension_factory,
556 self.module_manager.clone(),
557 self.script_store.clone(),
558 self.shutdown_handle.clone(),
559 );
560
561 self.runtime = new_rt;
562 self.emit_isolate_handle();
563
564 for script in new_scripts {
565 self.run_script(script.id).await;
566 }
567
568 self.guild_logger
569 .log(CreateLogEntry::info("vm restarted".to_string()));
570 }
571}
572
573pub enum TickResult {

Callers 1

handle_cmdMethod · 0.80

Calls 6

logMethod · 0.80
stop_vmMethod · 0.80
clearMethod · 0.80
compile_scriptMethod · 0.80
emit_isolate_handleMethod · 0.80
run_scriptMethod · 0.80

Tested by

no test coverage detected