feat: Hub monitoring takeover — event push system + config cleanup (v0.21.0)
Replace external Healthchecks.io with Hub-native event system. Controller now pushes structured events via POST /api/v1/event with typed detail structs. Hub handles dead man's switch, notification dispatch, and cooldowns. Phase 5: PushEvent() core method, 21 event types, expanded notification settings (11 toggles), Hub connection monitoring on dashboard, alerts. Phase 6: Deprecation log for ping UUIDs, pinger kept for transition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -110,6 +110,18 @@ func (s *Server) executeAllRestores() {
|
||||
return
|
||||
}
|
||||
|
||||
// Count pending apps and push DR start event
|
||||
pendingCount := 0
|
||||
for _, app := range plan.Apps {
|
||||
if app.Status == "pending" {
|
||||
pendingCount++
|
||||
}
|
||||
}
|
||||
if s.notifier != nil {
|
||||
s.notifier.NotifyDRStarted(pendingCount)
|
||||
}
|
||||
|
||||
successCount, failCount := 0, 0
|
||||
for i := range plan.Apps {
|
||||
app := &plan.Apps[i]
|
||||
if app.Status != "pending" {
|
||||
@@ -126,15 +138,22 @@ func (s *Server) executeAllRestores() {
|
||||
if err != nil {
|
||||
plan.UpdateApp(app.Name, "failed", err.Error())
|
||||
s.logger.Printf("[ERROR] Restore failed for %s: %v", app.Name, err)
|
||||
failCount++
|
||||
} else {
|
||||
plan.UpdateApp(app.Name, "done", "")
|
||||
s.logger.Printf("[INFO] Restore completed for %s", app.Name)
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
|
||||
plan.SetStatus("done")
|
||||
s.logger.Println("[INFO] All app restores completed")
|
||||
|
||||
// Push DR completion event
|
||||
if s.notifier != nil {
|
||||
s.notifier.NotifyDRCompleted(successCount, failCount)
|
||||
}
|
||||
|
||||
// Re-scan stacks so dashboard picks up restored apps
|
||||
if s.stackMgr != nil {
|
||||
if err := s.stackMgr.ScanStacks(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user