From eec1afae23e7513781242636475f138694d44d07 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Thu, 26 Feb 2026 14:07:28 +0100 Subject: [PATCH] fix(setup): start executeHubRestore goroutine in auto-process and manual hub restore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both autoProcessHubRestore and processHubRestore rendered the progress page (setup_restore_exec) without starting the executeHubRestore() goroutine, causing the template to poll forever showing "Indítás...". Co-Authored-By: Claude Opus 4.6 --- controller/internal/setup/handlers.go | 36 +++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/controller/internal/setup/handlers.go b/controller/internal/setup/handlers.go index a8af0fe..b4cb32e 100644 --- a/controller/internal/setup/handlers.go +++ b/controller/internal/setup/handlers.go @@ -386,21 +386,17 @@ func (s *Server) autoProcessHubRestore(w http.ResponseWriter, r *http.Request, c s.state.SetFormField("hub_infra_backup", string(ibJSON)) s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp } - s.state.SetStep("restore-confirm") + s.state.SetStep("restore-exec") s.state.Save() - // Show confirmation page with backup details + s.logger.Printf("[INFO] Setup: hub recovery received (hasInfra=%v) — starting restore", recovery.HasInfraBackup) + + // Start the restore goroutine, then render the progress page + go s.executeHubRestore() + csrf := ensureCSRFToken(w, r) data := map[string]interface{}{ - "CSRF": csrf, - "CustomerID": customerID, - "HasInfraBackup": recovery.HasInfraBackup, - "HasConfig": recovery.ConfigYAML != "", - "Source": "hub", - } - if recovery.HasInfraBackup && recovery.InfraBackup != nil { - data["Timestamp"] = recovery.InfraBackup.Timestamp - data["StackCount"] = len(recovery.InfraBackup.DeployedStacks) + "CSRF": csrf, } s.render(w, "setup_restore_exec", data) } @@ -495,21 +491,17 @@ func (s *Server) processHubRestore(w http.ResponseWriter, r *http.Request) { s.state.SetFormField("hub_infra_backup", string(ibJSON)) s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp } - s.state.SetStep("restore-confirm") + s.state.SetStep("restore-exec") s.state.Save() - // Show confirmation page with backup details + s.logger.Printf("[INFO] Setup: hub recovery received (hasInfra=%v) — starting restore", recovery.HasInfraBackup) + + // Start the restore goroutine, then render the progress page + go s.executeHubRestore() + csrf := ensureCSRFToken(w, r) data := map[string]interface{}{ - "CSRF": csrf, - "CustomerID": customerID, - "HasInfraBackup": recovery.HasInfraBackup, - "HasConfig": recovery.ConfigYAML != "", - "Source": "hub", - } - if recovery.HasInfraBackup && recovery.InfraBackup != nil { - data["Timestamp"] = recovery.InfraBackup.Timestamp - data["StackCount"] = len(recovery.InfraBackup.DeployedStacks) + "CSRF": csrf, } s.render(w, "setup_restore_exec", data) }