Fix AutoSave - Now Working !
This commit is contained in:
@@ -15,6 +15,8 @@ namespace PlantBox.Broker
|
|||||||
|
|
||||||
public bool IsRunning { get; set; } = true;
|
public bool IsRunning { get; set; } = true;
|
||||||
|
|
||||||
|
private Timer _autoSaveTimer;
|
||||||
|
|
||||||
public Broker(string[] args)
|
public Broker(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Initializing Broker...");
|
Console.WriteLine("Initializing Broker...");
|
||||||
@@ -34,7 +36,7 @@ namespace PlantBox.Broker
|
|||||||
Task.Run(() => ServerManager.Start());
|
Task.Run(() => ServerManager.Start());
|
||||||
|
|
||||||
// Auto-Save
|
// 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;
|
string input;
|
||||||
do
|
do
|
||||||
@@ -51,6 +53,7 @@ namespace PlantBox.Broker
|
|||||||
Console.WriteLine("Stopping Broker...");
|
Console.WriteLine("Stopping Broker...");
|
||||||
|
|
||||||
IsRunning = false;
|
IsRunning = false;
|
||||||
|
_autoSaveTimer.Dispose();
|
||||||
PlantBoxesManager.Save();
|
PlantBoxesManager.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user