diff --git a/Server/CurrentVersion.txt b/Server/CurrentVersion.txt index 35dc0fcf..869a043c 100644 --- a/Server/CurrentVersion.txt +++ b/Server/CurrentVersion.txt @@ -1 +1 @@ -2019.07.23.1531 +2019.07.27.1108 diff --git a/Server/Data/DataService.cs b/Server/Data/DataService.cs index e1f44eff..c0d23ce2 100644 --- a/Server/Data/DataService.cs +++ b/Server/Data/DataService.cs @@ -497,18 +497,20 @@ namespace Remotely.Server.Data { if (AppConfig.DataRetentionInDays > 0) { + var expirationDate = DateTime.Now - TimeSpan.FromDays(AppConfig.DataRetentionInDays); + var eventLogs = RemotelyContext.EventLogs - .Where(x => DateTime.Now - x.TimeStamp > TimeSpan.FromDays(AppConfig.DataRetentionInDays)); + .Where(x => x.TimeStamp < expirationDate); RemotelyContext.RemoveRange(eventLogs); var commandContexts = RemotelyContext.CommandContexts - .Where(x => DateTime.Now - x.TimeStamp > TimeSpan.FromDays(AppConfig.DataRetentionInDays)); + .Where(x => x.TimeStamp < expirationDate); RemotelyContext.RemoveRange(commandContexts); var sharedFiles = RemotelyContext.SharedFiles - .Where(x => DateTime.Now - x.Timestamp > TimeSpan.FromDays(AppConfig.DataRetentionInDays)); + .Where(x => x.Timestamp < expirationDate); RemotelyContext.RemoveRange(sharedFiles);