fix: avoid panicking if serverRecoveryWindow has still not been set (#525)

Closes: #523

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
This commit is contained in:
Leonardo Cecchi 2025-09-18 15:28:53 +02:00 committed by GitHub
parent 0ad066d195
commit dfd9861a3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,7 +59,12 @@ func setLastFailedBackupTime(
}
recoveryWindow := objectStore.Status.ServerRecoveryWindow[serverName]
recoveryWindow.LastFailedBackupTime = ptr.To(metav1.NewTime(lastFailedBackupTime))
if objectStore.Status.ServerRecoveryWindow == nil {
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
}
objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
return c.Status().Update(ctx, &objectStore)
})
}