Fix AutoSave - Now Working !

This commit is contained in:
2019-05-10 21:17:13 +02:00
parent 46cb938ea2
commit 9e8d1ee61b

View File

@@ -15,6 +15,8 @@ namespace PlantBox.Broker
public bool IsRunning { get; set; } = true;
private Timer _autoSaveTimer;
public Broker(string[] args)
{
Console.WriteLine("Initializing Broker...");
@@ -34,7 +36,7 @@ namespace PlantBox.Broker
Task.Run(() => ServerManager.Start());
// Auto-Save
new Timer(OnSave, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
_autoSaveTimer = new Timer(OnSave, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1));
string input;
do
@@ -51,6 +53,7 @@ namespace PlantBox.Broker
Console.WriteLine("Stopping Broker...");
IsRunning = false;
_autoSaveTimer.Dispose();
PlantBoxesManager.Save();
}