onQueue('high'); } public function uniqueId(): string { return (string) $this->server->id; } public function handle(ServerTransferMigrator $migrator): void { try { $result = $migrator->migrate($this->server, $this->targetUrl, $this->targetToken); $migrator->recordMigration($this->server, 'succeeded', [ 'export_id' => $result['export_id'], 'warnings' => $result['warnings'], 'checklist' => $result['checklist'], 'target_server_url' => $result['target_server_url'] ?? null, ]); } catch (Throwable $e) { $migrator->recordMigration($this->server, 'failed', ['error' => $e->getMessage()]); } } /** * The worker stopped the job, for example at its timeout. The target can manage the server already, * so the migrator asks the target before it records the result. */ public function failed(?Throwable $exception): void { app(ServerTransferMigrator::class)->recordStoppedMigration( $this->server, $this->targetUrl, $this->targetToken, $exception?->getMessage() ?: 'The transfer job stopped before it finished.', ); } }