fix(setup): start executeHubRestore goroutine in auto-process and manual hub restore

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 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 14:07:28 +01:00
parent 1e8a562bd3
commit eec1afae23
+14 -22
View File
@@ -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.SetFormField("hub_infra_backup", string(ibJSON))
s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp
} }
s.state.SetStep("restore-confirm") s.state.SetStep("restore-exec")
s.state.Save() 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) csrf := ensureCSRFToken(w, r)
data := map[string]interface{}{ data := map[string]interface{}{
"CSRF": csrf, "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)
} }
s.render(w, "setup_restore_exec", data) 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.SetFormField("hub_infra_backup", string(ibJSON))
s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp
} }
s.state.SetStep("restore-confirm") s.state.SetStep("restore-exec")
s.state.Save() 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) csrf := ensureCSRFToken(w, r)
data := map[string]interface{}{ data := map[string]interface{}{
"CSRF": csrf, "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)
} }
s.render(w, "setup_restore_exec", data) s.render(w, "setup_restore_exec", data)
} }