From d7bbbeade9ff367821d5703e98138c4db5417a3f Mon Sep 17 00:00:00 2001 From: Serraniel Date: Mon, 5 Feb 2018 20:33:40 +0100 Subject: [PATCH] Little fixes and debug database --- Discord Media Loader.Application/Classes/Core.cs | 9 +++++++++ Discord Media Loader.Application/Classes/Job.cs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index 4cef719..99ffc7c 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -92,8 +92,13 @@ namespace DML.Application.Classes } Logger.Debug("Loading database..."); +#if DEBUG + Database = new LiteDatabase(Path.Combine(DataDirectory, "config.debug.db")); + Database.Log.Logging += (message) => Logger.Trace($"LiteDB: {message}"); +#else Database = new LiteDatabase(Path.Combine(DataDirectory, "config.db")); Database.Log.Logging += (message) => Logger.Trace($"LiteDB: {message}"); +#endif Logger.Debug("Loading settings collection out of database..."); var settingsDB = Database.GetCollection("settings"); @@ -221,7 +226,11 @@ namespace DML.Application.Classes } if (Settings.RescanRequired) + { + Logger.Info("Restting timestamps"); job.KnownTimestamp = 0; + job.Store(); + } } Settings.RescanRequired = false; diff --git a/Discord Media Loader.Application/Classes/Job.cs b/Discord Media Loader.Application/Classes/Job.cs index 8fc31e2..af7de1e 100644 --- a/Discord Media Loader.Application/Classes/Job.cs +++ b/Discord Media Loader.Application/Classes/Job.cs @@ -167,6 +167,8 @@ namespace DML.AppCore.Classes { Trace("Updating StopTimestamp for next scan..."); StopTimestamp = SweetUtils.DateTimeToUnixTimeStamp(result[result.Count - 1].CreatedAt.UtcDateTime); + KnownTimestamp = StopTimestamp; + Store(); } Debug($"Fisnished scan of guild {GuildId} channel {ChannelId}.");