v0.4.7: Protected stack detail pages + backup page caching
Task 1: Protected stacks with .felhom.yml (slug) are now clickable on both dashboard and stacks pages. "Részletek" button added to protected stack actions section. Filebrowser .felhom.yml updated with resources metadata. Task 2: Backup page now reads from a cached FullBackupStatus that refreshes every 5 minutes in background + after each backup run. Page loads instantly instead of blocking on restic/docker subprocesses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,11 @@ func main() {
|
||||
var backupMgr *backup.Manager
|
||||
if cfg.Backup.Enabled {
|
||||
backupMgr = backup.NewManager(cfg, pinger, logger)
|
||||
backupMgr.AfterBackup = func() {
|
||||
nextDBDump := scheduler.NextDailyRun(cfg.Backup.DBDumpSchedule)
|
||||
nextBackup := scheduler.NextDailyRun(cfg.Backup.ResticSchedule)
|
||||
backupMgr.RefreshCache(nextDBDump, nextBackup)
|
||||
}
|
||||
go backupMgr.LoadSnapshotHistory()
|
||||
}
|
||||
|
||||
@@ -120,11 +125,28 @@ func main() {
|
||||
sched.Daily("backup", cfg.Backup.ResticSchedule, func(ctx context.Context) error {
|
||||
return backupMgr.RunBackup(ctx)
|
||||
})
|
||||
|
||||
// Cache refresh: every 5 minutes
|
||||
sched.Every("backup-cache", 5*time.Minute, func(ctx context.Context) error {
|
||||
nextDBDump := scheduler.NextDailyRun(cfg.Backup.DBDumpSchedule)
|
||||
nextBackup := scheduler.NextDailyRun(cfg.Backup.ResticSchedule)
|
||||
backupMgr.RefreshCache(nextDBDump, nextBackup)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
sched.Start(ctx)
|
||||
defer sched.Stop()
|
||||
|
||||
// Initial backup cache population (don't block startup)
|
||||
if cfg.Backup.Enabled && backupMgr != nil {
|
||||
go func() {
|
||||
nextDBDump := scheduler.NextDailyRun(cfg.Backup.DBDumpSchedule)
|
||||
nextBackup := scheduler.NextDailyRun(cfg.Backup.ResticSchedule)
|
||||
backupMgr.RefreshCache(nextDBDump, nextBackup)
|
||||
}()
|
||||
}
|
||||
|
||||
// --- Initialize API router ---
|
||||
apiRouter := api.NewRouter(cfg, stackMgr, syncer, cpuCollector, backupMgr, logger)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user