diff --git a/csharp/App/Backend/Database/Db.cs b/csharp/App/Backend/Database/Db.cs index 80cd15454..ebdab555c 100644 --- a/csharp/App/Backend/Database/Db.cs +++ b/csharp/App/Backend/Database/Db.cs @@ -1,3 +1,4 @@ +using System.Reactive.Concurrency; using System.Reactive.Linq; using InnovEnergy.App.Backend.DataTypes; using InnovEnergy.App.Backend.DataTypes.Methods; @@ -15,10 +16,10 @@ public static partial class Db private static SQLiteConnection Connection { get; } = new SQLiteConnection(DbPath); - public static TableQuery Sessions => Connection.Table(); - public static TableQuery Folders => Connection.Table(); - public static TableQuery Installations => Connection.Table(); - public static TableQuery Users => Connection.Table(); + public static TableQuery Sessions => Connection.Table(); + public static TableQuery Folders => Connection.Table(); + public static TableQuery Installations => Connection.Table(); + public static TableQuery Users => Connection.Table(); public static TableQuery FolderAccess => Connection.Table(); public static TableQuery InstallationAccess => Connection.Table(); @@ -38,9 +39,10 @@ public static partial class Db }); Observable.Interval(TimeSpan.FromDays(0.5)) - .StartWith(0) // Do it right away (on startup) + .StartWith(0) // Do it right away (on startup) + .ObserveOn(TaskPoolScheduler.Default) .SelectMany(Cleanup) - .Subscribe(); // and then daily + .Subscribe(); }