This commit is contained in:
2020-05-23 18:01:12 +00:00
parent b2a7b8e0b9
commit 4068c27663
2 changed files with 15 additions and 1 deletions

View File

@@ -61,6 +61,17 @@ namespace AyaNova.Biz
if (dbObject == null)
throw new System.Exception("GlobalOpsBackupSettings::PutAsync -> Global settings object not found in database!!");
// //testing UTC fuckiness
// var utcNow = DateTime.UtcNow;
// var desiredBackupTime = new DateTime(2020, 5, 23, 23, 55, 0).ToUniversalTime();
// var NextBackup = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, putObject.BackupTime.Hour, putObject.BackupTime.Minute, 0, DateTimeKind.Utc);
// if (NextBackup < utcNow) NextBackup = NextBackup.AddDays(1);
// //theory if nexxtbacup at the end of the adjustment is in the past then add a day to it
//If backup time has changed then reset last backup as well as it might block from taking effect
var ResetLastBackup = (putObject.BackupTime.Hour != dbObject.BackupTime.Hour || putObject.BackupTime.Minute != dbObject.BackupTime.Minute);

View File

@@ -35,13 +35,16 @@ namespace AyaNova.Util
}
internal static void SetNextBackup()
{
{
DateTime utcNow = DateTime.UtcNow;
//Has last backup run more than 24 hours ago?
if (NextBackup < utcNow.AddHours(-24))
{
//set it to today then
NextBackup = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, Backup.BackupTime.Hour, Backup.BackupTime.Minute, 0, DateTimeKind.Utc);
//Make sure next backup is in the future
if (NextBackup < utcNow)
NextBackup = NextBackup.AddDays(1);
}
else
{