This commit is contained in:
@@ -47,7 +47,7 @@ namespace AyaNova.Biz
|
||||
//not in db then get the default
|
||||
if (ret == null)
|
||||
throw new System.Exception("GlobalOpsSettingsBiz::GetAsync -> Global OPS settings object not found in database!!");
|
||||
|
||||
ret.LastBackup=ServerGlobalOpsSettingsCache.Backup.LastBackup;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace AyaNova.Biz
|
||||
//If backup time has changed then reset last backup as well as it might block from taking effect
|
||||
if (putObject.BackupTime.Hour != dbObject.BackupTime.Hour && putObject.BackupTime.Minute != dbObject.BackupTime.Minute)
|
||||
{
|
||||
ServerGlobalOpsSettingsCache.LastBackup = DateTime.MinValue;
|
||||
dbObject.LastBackup = DateTime.MinValue;
|
||||
}
|
||||
CopyObject.Copy(putObject, dbObject, "Id");
|
||||
ct.Entry(dbObject).OriginalValues["Concurrency"] = putObject.Concurrency;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace AyaNova.Biz
|
||||
//Yes, we've passed into the backup window time, but that's also true if we just ran the backup as well so
|
||||
//need to check for that as well...
|
||||
//Has last backup run more than 24 hours ago?
|
||||
if (ServerGlobalOpsSettingsCache.LastBackup > utcNow.AddHours(-24))
|
||||
if (ServerGlobalOpsSettingsCache.Backup.LastBackup > utcNow.AddHours(-24))
|
||||
{
|
||||
log.LogTrace("Hasn't been 24 hours since last backup yet"); return;//nope, so we have already run today's backup
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace AyaNova.Biz
|
||||
var biz = GlobalOpsBackupSettingsBiz.GetBiz(ct);
|
||||
var OpSet = await biz.GetAsync(false);
|
||||
await biz.PutAsync(OpSet);
|
||||
ServerGlobalOpsSettingsCache.LastBackup=utcNow;
|
||||
ServerGlobalOpsSettingsCache.Backup.LastBackup=utcNow;
|
||||
}
|
||||
log.LogDebug("Backup completed");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
|
||||
@@ -8,17 +9,16 @@ namespace AyaNova.Models
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
public DateTime BackupTime { get; set; }
|
||||
|
||||
public int BackupSetsToKeep { get; set; }
|
||||
public bool BackupAttachments { get; set; }
|
||||
[NotMapped]
|
||||
public DateTime LastBackup { get; set; }
|
||||
|
||||
public GlobalOpsBackupSettings()
|
||||
{
|
||||
Id = 1;//always 1
|
||||
BackupTime = new DateTime(2020, 5, 19, 23, 59, 0, DateTimeKind.Local).ToUniversalTime();//date doesn't matter it only uses hour
|
||||
|
||||
BackupSetsToKeep = 3;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace AyaNova.Util
|
||||
{
|
||||
|
||||
internal static GlobalOpsBackupSettings Backup { get; set; }
|
||||
internal static DateTime LastBackup { get; set; }
|
||||
// internal static DateTime LastBackup { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -29,7 +29,7 @@ namespace AyaNova.Util
|
||||
ct.GlobalOpsBackupSettings.Add(Backup);
|
||||
ct.SaveChanges();
|
||||
}
|
||||
LastBackup=FileUtil.MostRecentBackupFileDate();
|
||||
Backup.LastBackup=FileUtil.MostRecentBackupFileDate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user