fix: address review findings for backup management
- HIGH: Add sync.Mutex to backup Engine to prevent concurrent backup/restore operations - HIGH: Restore uses io.Copy instead of ReadFile to avoid OOM on large databases - HIGH: Send HTTP response before closing DB during restore, then perform destructive operations in a goroutine - HIGH: Create pre-restore safety backup before overwriting database - HIGH: Autobackup cron reschedules dynamically when settings change via callback pattern (same as DNS provider changes)
This commit is contained in:
@@ -205,6 +205,13 @@ func (s *Server) updateSettings(w http.ResponseWriter, r *http.Request) {
|
||||
go s.handleDNSSettingsChange(oldProvider, existing, updated)
|
||||
}
|
||||
|
||||
// Handle backup settings changes.
|
||||
backupChanged := existing.BackupEnabled != updated.BackupEnabled ||
|
||||
existing.BackupIntervalHours != updated.BackupIntervalHours
|
||||
if backupChanged && s.onBackupSettingsChanged != nil {
|
||||
s.onBackupSettingsChanged(updated.BackupEnabled, updated.BackupIntervalHours)
|
||||
}
|
||||
|
||||
respondJSON(w, http.StatusOK, map[string]string{"status": "updated"})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user