uuid = $uuid; $this->name = Host::query()->where('uuid', $uuid)->value('name') ?? ''; } public function remove() { $host = Host::query()->where('uuid', $this->uuid)->first(); if ($host !== null) { // Delete each run under its runner lock so an in-flight worker can't // keep mutating the server or write an event against a deleted run. foreach ($host->runs()->get() as $run) { Cache::lock('run:'.$run->uuid, 30)->block(15, function () use ($run) { $run->delete(); // cascades run_resources + step_events }); } // Drop the hub peer on the privileged provisioning worker (which owns // wg0), so a freed wg_ip can't route to the removed server via a stale peer. if (filled($host->wg_pubkey)) { RemoveWireguardPeer::dispatch($host->wg_pubkey); } $host->delete(); } return $this->redirectRoute('admin.hosts', navigate: true); } public function render() { return view('livewire.admin.confirm-remove-host'); } }